Comparing two images (rotate, brightness)
Hi,
So I have this:
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?
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?
It should compare the colors and that it has a inner circle in it
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.
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?
template
Did not saw your comment, This should be a better template, and then just run HoughCircles again?