cys
cys

Reputation: 173

Precisely Compare 2 images for differences using OpenCV

I am working on a project to capture images via webcam in a predefined time interval, and continuously compare the images to a template (good image) and give an error if the difference is > tolerance set.

I working out using OpenCV. Would like to have advice how should I do it, e.g. best method, etc.

Appreciate if any one can help me on this. Thanks.

Upvotes: 5

Views: 15260

Answers (1)

jeff7
jeff7

Reputation: 2182

An easy way is to just take the L2-norm between the image pairs:

double l2_norm = cvNorm( img1, img2 );

You'll have to experiment with setting the appropriate threshold. Of course this method is not robust to lighting changes, viewpoint changes, etc but its simple and fast.

Upvotes: 3

Related Questions