查找具有不同强度/亮度的相似图像 [英] Finding similar images with different intensities/brightness
问题描述
假设我的图像如下:
比较两个图像之间的相似性有什么选择?显然,它们是同一张图像,只是亮度不同.我找不到任何可行的方法,目前,我最好的选择是训练一个cnn或自动编码器并比较输出的特征向量,但这似乎有点过头了.任何提示将不胜感激.
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.
推荐答案
相当健壮的工作解决方案(我测试过)是检查像素之间亮度符号变化的相关性.
Pretty robust working solution (I tested) is to check correlation of brightness sign changes between pixels.
即假设图像A和B循环了很多像素:
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++;
}
反之亦然.COUNTER越高,图像越相似.
And vice versa for opposite relationship. The higher the COUNTER the more similar are the images.
重要提示:我对(区域间)按比例缩小的图像(不是全尺寸)测试了该方法,因为全尺寸图像可能包含一些压缩伪像.我的直觉表明,无论如何,它都可以在全尺寸图像上工作,只是具有不同的阈值.如果不是,请按区域调整大小以保留良好的平均亮度值(类似于OpenCV中的INTER_AREA),它将成功解决问题.
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.
该方法的其他注释位于图像比较算法零件优化2.
Additional notes on the method are in image comparison algorithm part Optimization 2.
这篇关于查找具有不同强度/亮度的相似图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!