Vz Image Compare Library  v1.0.0-2969
Vz Image Comparison C++ Library
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
Settings

There are several settings that have a high impact on the results of the library.

Given this master image:

E_master.jpg

...and this test image:

E_test_image.png

When the comparison takes place, the first output is a diff. This can be done with the full colour image or a greyscale image, and is determined by calling one of the following:

vz::ImgCmp image_compare;
// image_compare.set_flag(vz::ImgCmp::Flags::kDiffColour );
image_compare.set_flag(vz::ImgCmp::Flags::kDiffGreyscale);

The colour differences look like this:

1588482608-full_size-51_contours-2_minarea-3_dilate_erode-colour_diff-triangle_threshold-draw_contours-draw_rectangles-5-differences.png

...while the equivalent greyscale differences look like this:

1588481728-full_size-43_contours-2_minarea-3_dilate_erode-greyscale_diff-triangle_threshold-draw_contours-draw_rectangles-5-differences.png

These images are available via vz::ImgCmp::differences.

The differences are then converted to binary masks. There are several techniques and settings involved in the process, the key ones being:

This results in black-and-white single channel images like this:

1588542742-full_size-51_contours-2_minarea-3_dilate_erode-colour_diff-triangle_threshold-draw_contours-draw_rectangles-6-diff_threshold.png

The single-channel threshold mask is then used to obtain the contours of all the differences. A contour is a vector of 2-D points (X and Y coordinate pairs) which indentify the perimeter of each difference.

Unlike everything else so far in this process, this is not a "visual" thing, but if needed all the contours are stored together in a vector called vz::ImgCmp::differences_contours.

The last step is to draw these contours on an image. This is done in vz::ImgCmp::annotate(). There are several options that control how the contours are displayed.

Key settings are:

1588545296-full_size-43_contours-2_minarea-3_dilate_erode-greyscale_diff-triangle_threshold-draw_contours-7-annotated.png

 

1588545374-full_size-43_contours-2_minarea-3_dilate_erode-greyscale_diff-triangle_threshold-draw_contours-7-annotated.png

 

1588545501-full_size-43_contours-2_minarea-3_dilate_erode-greyscale_diff-triangle_threshold-draw_contours-draw_rectangles-7-annotated.png