I have two images, one is a big image another one is small which is a portion of the big image. Now I need to find if the big image contains the small image and get the frame of the small image inside the big image.
I want this to be done in Objective-C, I can't use any webservices/frameworks.
I am using the following code now, which gives YES
only if the two images are identical.
- (BOOL)isEqualToByBytes:(UIImage *)oneImage with:(UIImage *)otherImage {
NSData *imagePixelsData = (NSData *)CFBridgingRelease(CGDataProviderCopyData(CGImageGetDataProvider(oneImage.CGImage)));
NSData *otherImagePixelsData = (NSData *)CFBridgingRelease(CGDataProviderCopyData(CGImageGetDataProvider(otherImage.CGImage)));
BOOL comparison = [imagePixelsData isEqualToData:otherImagePixelsData];
CGDataProviderRelease((CGDataProviderRef)imagePixelsData);
CGDataProviderRelease((CGDataProviderRef)otherImagePixelsData);
return comparison;
}