New Compare Feature Using Read Mask

Announcements pertaining to ImageMagick, or ImageMagick related software. This list is moderated. No discussions here, instead post to the users group instead.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

New Compare Feature Using Read Mask

Post 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
Post Reply