Re: Compare images in Cocoa
Re: Compare images in Cocoa
- Subject: Re: Compare images in Cocoa
- From: "Karan, Cem (Civ, ARL/CISD)" <email@hidden>
- Date: Fri, 31 Oct 2008 07:29:33 -0400
- Thread-topic: Re: Compare images in Cocoa
On Thu, 30 Oct 2008 20:21:47 -0700, Pierce Freeman wrote:
> Hi everyone. I am wondering if there is some way to compare
> two images in Cocoa, and then somehow spit out a percent of
> how similar they are. The only way I could think of is
> comparing every pixel, but this seems like it would take a
> long time, and even so I have no idea how to go about doing that.
>
> Thanks for your help.
If you're willing to force someone to look at the image, you can get away with a really fast hack; use coreimage to do a Difference Blend Mode merge between the two images. If they are identical, the resulting image will be black. Anywhere the images are different, you'll get colors. As others have mentioned, this trick will not work if the images are different sizes, misaligned, rotated, different resolutions, etc. It is similar to what Beyond Compare does when it compares images (although IIRC it uses XOR on each pixel, not difference), and is only really good for quickly checking what changed between two images that are already fairly similar (which is handy if you want to know what modifications your artist did to the resources you have in your application).
Good luck,
Cem Karan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden