Finding similar images with different intensities/brightness

回眸只為那壹抹淺笑 提交于 2021-01-27 12:27:03

问题


Suppose I have images as follows:

What would be my options to compare the similarity between the two images? Obviously they are the same image just with different brightness. I couldn't find any plausible way for this and currently my best bet would be to train a cnn or autoencoder and compare the feature vectors of the outputs, but that just seems a bit overkill for this. Any tips would be appreciated.


回答1:


Pretty robust working solution (I tested) is to check correlation of brightness sign changes between pixels.

I.e. assuming images A and B, loop for significant number of pixels:

IF (
  (brightness of pixel 1 from A IS LARGER than brightness of pixel 2 from A)
  AND
  (brightness of pixel 1 from B IS LARGER than brightness of pixel 2 from B)
) {
  COUNTER++;
}

And vice versa for opposite relationship. The higher the COUNTER the more similar are the images.

IMPORTANT: I tested the method on (inter-area) scaled-down images, not full size, as full size images may contain some compression artifacts. My intuition suggests it will work on full size images anyway, just with a different threshold. If not, resize by area to preserve well average brightness values (similar to INTER_AREA in OpenCV), and it will do the trick.

Additional notes on the method are in image comparison algorithm part Optimization 2.



来源:https://stackoverflow.com/questions/62704531/finding-similar-images-with-different-intensities-brightness

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!