如何比较两个边缘图像(在OpenCV)? [英] How do I compare two edge-images (in OpenCV)?
问题描述
在我的项目中,我需要比较图像。一个图像示出了渲染模型,而另一个图像是照片,其中示出了在模型中表示的真实对象。我真正想要的是什么:
- 该算法必须比较两个图像并返回一个数字,描述相似性。
- 这两个图像都表示为二进制图像,只包含真实渲染图像/照片的轮廓/边缘。 / li>
- 照片中的对象比渲染图像多很多。所以我只想检查到渲染对象的视点是否几乎相同的视点到照片中的真实对象。 (例如:一辆汽车被模型化,所以它逼近一辆真正的汽车,我从一个特殊的位置和方向拍摄真实的汽车的照片现在我想检查,如果我的虚拟相机的位置和方向看着渲染车是几乎相同,比我的现实生活中的相机的位置和方向)。解决方案只是将渲染图像的白色像素与照片的像素(作为边缘图像)进行比较。其他像素不感兴趣。
- 图像比较的返回值应该越小,虚拟摄像机的方向和位置就越适合实际摄像机的方向和位置。
- The algorithm has to compare the two images and return a number, that describes the similarity. Let's say the lower the number is, the better the images fit together.
- Both images are represented as binary images which only contain the contours / edges of the real render-image / photo.
- The photo has a lot more objects in it than the render-image. So i only want to check if the viewpoint to the render-object is nearly the same than the viewpoint to the real object in the photo. (Example: A car is modelled so it approximates a real car. I take a photo of the real car from a special position and orientation. Now i want to check, if the position and orientation of my virtual camera looking at the render-car is nearly the same, than the position and orientation of my real-life-camera). The solution is only to compare the white pixels of the render image to the pixels of the photo (as edge-image). The other pixels are not interesting.
- The returned value of the image-comparision should decrease the better my orientation and position of the virtual camera fits to the real camera's orientation and position.
我试图计算两个图像的欧几里得距离,但是结果只有当像素完全相符时才是好的。现在我正在寻找替代品。
到现在为止,我考虑使用归一化互相关,但我真的不知道它是否适合我的任务。
问题是,如果归一化互相关值得一试,或者有更好的方法来解决我的问题!
算法应该尽可能快,因为我比较了很多图像。
非常感谢
感谢您的建议。我有点困惑,因为归一化的交叉纤芯和Haussdorff距离似乎是好的在大图片中找到一个小模式。
问题是:这两种算法是否也适用于比较相同大小的2张照片?
这里是一个需要比较的2张图片的例子。目前我每秒比较大约120张照片。
太糟糕了,我不能将照片作为新用户发布。所以这里是直接链接:
http://s14.directupload.net/file/d /2674/t8qzbq9i_png.htm
如何尝试将Haussdorff距离作为起点? 此处提供了一般概念和实施方式。文章:
使用Hausdorff距离比较图像,由DP Huttenlocher-1993。
in my project i need to compare to images. One image shows a render-model and the other image is a photo, in which the real object, which is represented in the model, is shown. What i exactly want:
I tried to calculate the euclidian distance of the two images but the result is only good, when the pixels exactly fit to each other. Now i am searching for alterantives.
Until now i considered to use the normalized cross-correlation, but i really dont know if it fits to my task.
The question is, if the normalized cross-correlation is worth a try or if there are better methods of solving my problem!
The algorithm should be as fast as possible, because i compare a lot of images.
Thanks a lot
Thanks for your suggestions. I am a little confused due to the fact that the normalized cross-corellation and Haussdorff distance seem to be good for finding a small pattern in a big picture.
The question is: Are the two algorithms also good for comparing 2 pictures of the same size?
Here is an example of 2 images that have to be compared. At the moment i am comparing around 120 pictures-paires a second.
Too bad that i cannot post images as a new user. So here is the direct link: http://s14.directupload.net/file/d/2674/t8qzbq9i_png.htm
How about experimenting with the Haussdorff distance as a starting point? General idea and c implementation here. Article here:
Comparing images using the Hausdorff distance, by DP Huttenlocher - 1993.
这篇关于如何比较两个边缘图像(在OpenCV)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!