English 中文(简体)
与 C++ 和 OpenCV 的图像比较方法
原标题:Image comparison method with C++ and OpenCV

I am new to OpenCV. I would like to know if we can compare two images (one of the images made by photoshop i.e source image and the otherone will be taken from the camera) and find if they are same or not. I tried to compare the images using template matching. It does not work. Can you tell me what are the other procedures which we can use for this kind of comparison?

问题回答

图像比较可以不同方式进行,这取决于你所想到的目的:

  • if you just want to compare whether two images are approximately equal (with a few luminance differences), but with the same perspective and camera view, you can simply compute a pixel-to-pixel squared difference, per color band. If the sum of squares over the two images is smaller than a threshold the images match, otherwise not.
  • If one image is a black-white variant of the other, conversion of the color images is needed (see e.g. http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale). Afterwarts simply perform the step above.
  • If one image is a subimage of the other, you need to perform registration of the two images. This means determining the scale, possible rotation and XY-translation that is necessary to lay the subimage on the larger image (for methods to register images, see: Pluim, J.P.W., Maintz, J.B.A., Viergever, M.A. , Mutual-information-based registration of medical images: a survey, IEEE Transactions on Medical Imaging, 2003, Volume 22, Issue 8, pp. 986 – 1004)
  • If you have perspective differences, you need an algorithm for deskewing one image to match the other as well as possible. For ways of doing deskewing look for example in http://javaanpr.sourceforge.net/anpr.pdf from page 15 and onwards.

祝你好运!

You should try SIFT. You apply SIFT to your marker (image saved in memory) and you get some descriptors (points robust to be recognized). Then you can use FAST algorithm with the camera frames in order to find the coprrespondent keypoints of the marker in the camera image. You have many threads about this topic:

< a href=" "https://stackoverflow.com/ questions/8896771/how-to-get-a-rectangle-around-the-target-objects-the-fatures-extrated-by" 如何利用开放 CV/a中SIFT所提取的特征在目标对象周围获得矩形

< a href=" "https://stackoverflow.com/ questions/46558390/ how-to-sear-the-image-for-an-object-with-sift-and-opencv' 如何搜索图像, 以使用 SIFT 和 OpenCV 搜索对象?

< a href=" "https://stackoverflow.com/ questions/7296915/opencv-object-attact-mating-using-surf- descriptors-and-bruteforcematcher" > OpenCV - 使用 SFR 描述符和 BruteForceMatcher

祝你好运





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签