This question may seem a duplicate, but it has kind of specific moment that may differ from other questions like this...
So... I have two images. Both are captured the same screen. In my code crops a two(screenCaptureFirst and screenCaptureSecond) big images into small cropped images(each cropped image has 32x32 dimentions). Then I push them into two arrays. And now I have to compare each element of two arrays.
- (void) differenceDetector{
int index=0;
for (int currentGridY=0; currentGridY<newCapturedImage.size.height; currentGridY+=gridSize) {
for (int currentGridX=0; currentGridX<newCapturedImage.size.width; currentGridX+=gridSize) {
CGRect rect=CGRectMake(currentGridX, currentGridY, gridSize, gridSize);
UIImage *croppedNewImage=[self croppedImage:rect anImage:newCapturedImage];
[arrayOfNewImageGrids addObject:croppedNewImage];
UIImage *croppedOldImage=[self croppedImage:rect anImage:oldCapturedImage];
[arrayOfOldImageGrids addObject:croppedOldImage];
if ([[arrayOfNewImageGrids objectAtIndex:index]isEqual:[arrayOfOldImageGrids objectAtIndex:index]]) {
NSLog(@"Index=%d",index);
}
NSLog(@"newGridArray=%@",[arrayOfNewImageGrids objectAtIndex:index]);
NSLog(@"oldGridArray=%@",[arrayOfOldImageGrids objectAtIndex:index]);
index++;
}
}
The problem is when it goes reaches if the result of comparison is FALSE although in arrays are cropped images of the same big image.
Thanks in Advance....