imageComparator icon indicating copy to clipboard operation
imageComparator copied to clipboard

Same photo with different brightness

Open nibalk opened this issue 11 years ago • 4 comments

Thanks for the great effort. Need some help to solve the below mentioned issue. I have noticed that if we use the same photo with different brightness it consider that two photos as "Not duplicates". I have tried below example, but didn't work. Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGB2HSV); Imgproc.cvtColor(img2, img2, Imgproc.COLOR_RGB2HSV);

Could you please help me with this ? Thanks!

nibalk avatar Feb 14 '14 08:02 nibalk

You could convert both images to grayscale and then check for similarities.

torcellite avatar Feb 14 '14 16:02 torcellite

Thanks for the quick reply. Does it mean that we have to do something like this ? Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGBA2GRAY); Imgproc.cvtColor(img2, img2, Imgproc.COLOR_RGBA2GRAY); Or simply use the Android way of grayscale the image ? Thanks!

nibalk avatar Feb 17 '14 06:02 nibalk

The code you've written above should do it. On Feb 17, 2014 12:21 PM, "nibalk" [email protected] wrote:

Thanks for the quick reply. Does it mean that we have to do something like this ? Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGBA2GRAY); Imgproc.cvtColor(img2, img2, Imgproc.COLOR_RGBA2GRAY); Or simply use the Android way of grayscale the image ? Thanks!

Reply to this email directly or view it on GitHubhttps://github.com/torcellite/imageComparator/issues/2#issuecomment-35232441 .

torcellite avatar Feb 17 '14 13:02 torcellite

oopsss! Even if I tried it still it can't identify it as duplicate images :) I will have a look again.

Do you have any idea how to change the code to show only the mismatching areas of the two images. Currently it's showing the matching areas using green color lines. I want to do it the other way round. I have already tried passing the mismatches to below method. But didn't work.

I might be doing some crazy thing. :) I have no idea of OpenCV API. Any good resource to refer it.

Thanks!

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Features2d.drawMatches(img1, keypoints, img2, dupKeypoints, missmatches, img3, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS);

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for (int i = 0; i < totalMatchCount; i++) { if (matchesList.get(i).distance <= min_dist) { matches_final.add(matchesList.get(i)); } else { missmatches_temp.add(matchesList.get(i)); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

nibalk avatar Feb 18 '14 02:02 nibalk