Alright, I got it to work but it is outputting the canonical <link > tag twice.
This is the code I used I just need to know what extra step(s) I need to take to keep it from duplicating
function attachment_wpseo_canonical ($can) {
global $wp_query;
$attachment_page_id = $wp_query->post->ID;
$parent_post = get_post($attachment_page_id);
$parent_post_id = $parent_post->post_parent;
$parent_post_permalink = get_permalink($parent_post_id);
echo "<link rel=\"canonical\" href=\"$parent_post_permalink\" />";
}
add_filter('wpseo_canonical','attachment_wpseo_canonical');