这个问题可能看起来是重复的,但它有一种特定的时刻,可能与其他类似的问题不同......
所以...我有两张图片。两者都是在同一个屏幕上捕获的。在我的代码中,将两个(screenCaptureFirst 和 screenCaptureSecond)大图像裁剪成小的裁剪图像(每个裁剪图像都有 32x32 尺寸)。然后我将它们推入两个数组。现在我必须比较两个数组的每个元素。
- (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++;
}
}
问题是,如果比较结果为 FALSE,尽管在数组中是同一大图像的裁剪图像,但它何时到达。
提前致谢....