Java - 图像识别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23281582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java - Image Recognition
提问by user2808109
I have about 5000 images with water marks on them and 5000 identical images with no watermarks. The file names of each set of images are not correlated to each other in any way. I'm looking for an API in Java preferably that I can use to pair each water marked image with its non-water marked pair.
我有大约 5000 张带有水印的图像和 5000 张没有水印的相同图像。每组图像的文件名彼此之间没有任何关联。我正在寻找 Java 中的 API,我最好可以用它来将每个有水标记的图像与其非水标记对配对。
回答by jgrocha
You can use the OpenCV library. It can be used in Java. Please follow http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html
您可以使用 OpenCV 库。它可以在 Java 中使用。请遵循http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html
Regarding image compare, you can see another useful answer here: Checking images for similarity with OpenCV
关于图像比较,您可以在这里看到另一个有用的答案:检查图像与 OpenCV 的相似性
回答by Spektre
I think this is more about performance then about the image comparison itself and the answer is written in such manner so if you need help with the comparison itself comment me ...
我认为这更多是关于性能,然后是关于图像比较本身,答案是以这种方式写的,所以如果你需要比较本身的帮助,请评论我......
create simplified histogram for each image
let say 8 values per each channel limiting to 4 bits per each intensity level. That will lead to
3*8*4=3*32
bits per imagesort images
take above histogram and consider it as a single number and sort the images of
A
group by it does not matter if ascending or descendingmatching
A
andB
grouped imagesnow the corresponding images should have similar histograms so take image from unsorted group
B
(watermarked), bin-searchall the closest match inA
group (original) and then compare more with more robust methods just against selected images instead of5000
.add flag if image from
A
group is already matchedso you can ignore already matched images in bullet #3to gain more speed
为每个图像创建简化的直方图
假设每个通道有 8 个值,每个强度级别限制为 4 位。这将导致
3*8*4=3*32
每个图像的位数排序图像
取上面的直方图并将其视为单个数字并按
A
升序或降序对组的图像进行排序匹配
A
和B
分组图像现在相应的图像应该具有相似的直方图,因此从未排序的组
B
(带水印)中获取图像,对组(原始)中的所有最接近的匹配进行bin 搜索A
,然后使用更稳健的方法进行更多比较,仅针对所选图像而不是5000
。如果来自
A
组的图像已经匹配,则添加标志所以你可以忽略子弹#3 中已经匹配的图像以获得更快的速度
[Notes]
[笔记]
there are other ways to improvement like use Perceptual hash algorithms
还有其他改进方法,例如使用感知哈希算法