Page 1 of 1

New Compare Feature Using Read Mask

Posted: 2016-12-15T15:19:45-07:00
by fmw42
As of IM 7.0.3.9, IM allows a read-mask to be used to limit the regions to be compared. This is not back-ported to IM 6.

As before, a perfect compare has partially transparent white overlay (lowlight-color), non-matches has partially transparent red overlay (highlight-color) and now the ignored regions from the mask have partially transparent gray overlay.

For example:

Image1
Image

Image2
Image

Read-Mask:
Image

Code: Select all

magick compare -metric rmse -read-mask hat_mask_124_124_417_44.png hat_124_124_417_44.png hat_124_124_417_44_green.png hat_diff_A.png
0 (0)
Image


Swapping the two images:

Code: Select all

magick compare -metric rmse -read-mask hat_mask_124_124_417_44.png hat_124_124_417_44_green.png hat_124_124_417_44.png hat_diff_D.png
0 (0)
Image


Similarly for subimage-search compares. But the read-mask and associated image must be enclosed in parentheses. Also the ignored region will be red (highlight-color) for the time being.

Code: Select all

magick compare -metric rmse -subimage-search -dissimilarity-threshold 1 logo: \( -read-mask hat_mask_124_124_417_44.png hat_124_124_417_44_green.png \) hat_diff_C.png
0 (0) @ 417,44
Image
Image



In IM 7.0.3.10, one can specify the masklight color (only for same sized image compares) which defaults to partially transparent gray.

Code: Select all

magick compare -metric rmse -define compare:masklight-color=blue -read-mask hat_mask_124_124_417_44.png hat_124_124_417_44.png hat_124_124_417_44_green.png hat_diff_B.png
Image