Possible Duplicate:
How does one compare one image to another to see if they are similar by a certain percentage, on the iPhone?
I've found this code and am trying to understand it better:
UIImage *img1 = // Some photo;
UIImage *img2 = // Some photo;
NSData *imgdata1 = UIImagePNGRepresentation(img1);
NSData *imgdata2 = UIImagePNGRepresentation(img2);
if ([imgdata1 isEqualToData:imgdata2]) {
NSLog(@"Same Image");
}
Will this confirm that image 1 is exactly the same as image 2? Is this method best practice, or is there a better approach to this?
To compare two photos create an album with two photos, then view them enlarged and switch between the tow photos. i is not possible in Photos iOS. To compare two photos create an album with two photos, then view them enlarged and switch between the tow photos.
Compare the pictures pixel for pixel, count the matches and the non matches. If they are within a certain threshold of error, you have a match. Otherwise, you could try reducing the resolution up to a certain point and see if the probability of a match improves.
An image comparison system that identifies differences utilizing AI image recognition. This is a system that compares two different data sets such as documents, drawings and photos and extracts any image differences between them.
Your code is comparing the two images bit by bit, so yes it's a 100%-comparison.
If you need something faster you can generate an hash from each UIImage
and compare the two hashes, as explained here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With