I want to programmatically detect a "material difference" between two images ignoring cropping and scaling changes.
In other words, if image A shows a tree, a car, and a cloud, and image B is just a (slightly) cropped and (slightly) smaller copy of A (but all other features are untouched) and lower quality, then I want to consider these a match. But if B has a different cloud, or the car has moved (etc), then the images are different.
Example: Here is image A:
And here, image B, is just a cropped and resized version of A:
But now, here image C is not only cropped/resized but also has a yellow asterisk.
I would like to detect changes of the kind between A and C, but ignore the differences between A and B. I have tried imagemagick subimage search but it is both (1) extremely slow and (2) fails to find the subimage no matter what metric I use (probably because image B has higher jpg compression, aka lower quality). A perceptual hash scores the images as "similar" despite the asterisk because the pictures are largely similar. Perhaps something based on feature detection with OpenCV might be my best bet?
question from:
https://stackoverflow.com/questions/65862499/detecting-artifact-differences-between-two-images 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…