Ask Your Question

Algorithm for detect similar photos

asked 2017-07-03 02:25:01 -0500

GiGa.91 gravatar image

Hello to everyone, I wanted to ask you advice. My goal is to create an algorithm that succeeds with a good percentage, to see if two pictures are similar. I have a master photo and all the photos i want to compare with this to see if they are "the same". I wanted to divide the algorithm in 3 points.

1)Load photo to compare and adjust brightness, contrast, histogram 2)I adjust the perspective by calculating matrix h with the original photo 3)I make the difference between the master picture and this (absdiff)

My problem is: how do I get a similar picture to that master in brightness and contrast

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-07-03 02:33:27 -0500

berak gravatar image

updated 2017-07-03 02:39:23 -0500

don't reinvent the wheel.

since lately, there's a new img_hash module in opencv_contrib, that should do exactly, what you need.

(get latest opencv3 master + latest opencv_contrib)

edit flag offensive delete link more


I can use this form to know if the pictures are similar but after I have to extract the differences. Can i do it directly with adsdiff?

GiGa.91 gravatar imageGiGa.91 ( 2017-07-03 06:03:01 -0500 )edit

sure, but why ?

berak gravatar imageberak ( 2017-07-03 06:10:59 -0500 )edit

I explain: I do a series of photos to a target. If the photographs are the same, they have not fired. If I find a difference in the photographs then I suppose they fired. To find where they shot I searched for circumferences. When I have to find the next hole I do not use the original photograph anymore but the one where the first hole is. I wanted to find the difference between the two pictures to do this

GiGa.91 gravatar imageGiGa.91 ( 2017-07-03 06:50:21 -0500 )edit

hole ? fired ?

i don't think, i understood anything from the last comment.

berak gravatar imageberak ( 2017-07-03 07:11:31 -0500 )edit

Sorry for my bad English. What did you not understand? I try to explain this again

GiGa.91 gravatar imageGiGa.91 ( 2017-07-03 07:27:01 -0500 )edit

tbh, i did not understand any of it, and yes, please try again !

(if there are examplle images, maybe you can add them to your question ? (there is an upload image button)

berak gravatar imageberak ( 2017-07-03 07:39:11 -0500 )edit

ok. My goal is to look a target with a cam. The target is this:

I would like to calculate the x / y position of the hole. example:

As you can see the second photo has the target slightly moved. How can I get a good result?

ps: It may happen that the images have different brightness, example:

GiGa.91 gravatar imageGiGa.91 ( 2017-07-03 08:31:56 -0500 )edit

now, please look again, at how thisquestionstarted, and ask yourself, how on earth could we ever have guessed, what you mean ? (it's a totally different question !)

berak gravatar imageberak ( 2017-07-03 08:46:54 -0500 )edit

You're right. You know how to help me? Can you give some advice on how to get a good result?

GiGa.91 gravatar imageGiGa.91 ( 2017-07-03 09:05:30 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-07-03 02:25:01 -0500

Seen: 137 times

Last updated: Jul 03 '17