xDevilx
xDevilx

Reputation: 3

Compare Two Image Qualitatively Opencv

I've tried using Histogram Comparison for images comparison. However, it doesn't seems to provide me with good result. For your information:

-Application: visual inspection for any defects on a specific object.

-Test image (static): captured through fixed camera which may result with different contrast & brightness.

-Condition: Check for defects but not lightening issue.

As I know, histogram comparison is rather contrast & brightness sensitive. Also, I've gone through feature detection such as SURF and a very shallow way only. SURF is rather robust but it do not return me with qualitative data, such as percentage of similarity between two images. I need a threshold in order to know whether the "mismatch" is contrast & brightness issue or is the real defects.

Any suggestion or example? Is that possible for me to continue sticking with histogram comparison? Maybe perform histogram equalization will help?

Upvotes: 0

Views: 1454

Answers (1)

sansuiso
sansuiso

Reputation: 9379

It depends on the type of defects that you want to detect. Here, it seems that your defects are can't be described by geometric features, but rather by some light level (brightness ? color ?) change.

As you guessed, the first step is to get rid of the natural intensity change. You can do it by histogram matching of the image under test onto the reference image rather than by histogram equalization. An even more robust algorithm for this task is called Midway equalization.

After you've done that, you may need to register (i.e., overlay) your image under test to your reference image. There are many algorithms for that, and in the end it will depend on your images.

Finally, you'll want to detect the changes. Histogram mismatch can be some metric used for that, but it seems to me to be some really coarse-level tool. If you need finer precision, image difference followed by appropriate filtering could be useful, but it depends a lot on your images and application context.

Upvotes: 2

Related Questions