Comparing two images (rotate, brightness)

asked 2016-01-09 06:12:41 -0600

dazdylz gravatar image

updated 2016-01-09 12:45:16 -0600

Hi,

So I have this:

image description

I need to compare the template (left window) with the detected one (middle window)

What is the best way to do this? As you can see, it can be rotated and the brightness can be diffrent?

UPDATE:

All right, so I now have this

double dist = matchShapes(findContours(temp)[0], findContours(backgroundElem(roi, d))[0], CV_CONTOURS_MATCH_I1, 0);
 cout << dist << endl;

dist gives some random values, what do I do know?

edit retag flag offensive close merge delete

Comments

On the simple end of things is the HuMoments. These are invariant to rotation.

Histograms are also pretty useful.

What exactly about the images are you trying to compare?

Tetragramm gravatar imageTetragramm ( 2016-01-09 11:03:18 -0600 )edit

It should compare the colors and that it has a inner circle in it

dazdylz gravatar imagedazdylz ( 2016-01-09 11:05:24 -0600 )edit

Well, to compare the colors, the histogram is probably the best choice. You probably want to pre-process the image by subtracting the mean to remove illumination differences.

Finding the inner circle is harder. The Hough transform can find circles, but only if they show up to the Canny Edge detection. If you can enhance the contrast on the edge of the circle reliably enough, that would work. Otherwise you'll need to find something else.

It might be workable to do the HuMoments on just the center portion. They should do a pretty good job being invariant to the types of changes it would see. You'd have to do a bit of testing to make sure the threshold for same vs different is correct, but it shouldn't be too hard.

Tetragramm gravatar imageTetragramm ( 2016-01-09 12:44:17 -0600 )edit

All right, so I now have this: double dist = matchShapes(findContours(temp)[0], findContours(backgroundElem(roi, d))[0], CV_CONTOURS_MATCH_I1, 0); cout << dist << endl;

dist gives some random values, what do I do know?

dazdylz gravatar imagedazdylz ( 2016-01-09 12:44:34 -0600 )edit

template

Did not saw your comment, This should be a better template, and then just run HoughCircles again?

dazdylz gravatar imagedazdylz ( 2016-01-09 13:05:17 -0600 )edit