开发者

compare two images using OpenCV

I want to compare two images using 开发者_如何学JAVAOpenCV. Could I filter the nearest matching result among other training data set..?

Example : the Database containing training image which show number 5 in using one hand.

Is it possible to match someone else ,same sign with that training image..? Using OpenCV. Please help me.


Like sinelaw said, there is no straightforward, easy solution in general.

However, I can think of one simple way that would work for your specific example.

  • Detect areas corresponding to human skin in the image. This is assuming the person isn't wearing gloves (if they are, knowing the color of the gloves will help). See this example on skin detection. Basically, you convert your image into YUV and threshold using the chrominance, because it is known that human skin occupies only a small part of the chroma spectrum, regardless of race
  • Detect contours. In OpenCV, this is done using cvFindContours function. Here's an example of that function being used to find ellipses. You're interested in contours of any shape, not just ellipses at this point.
  • Now, go through all your contours, and look for a contour that looks like an open hand making the 5 signal. This isn't as hard as this sounds, because you're after a convex hull (red outline) with a 4-5 convexity defects (the black arrows):

compare two images using OpenCV

  • The image above is from the OpenCV API description of cvConvexityDefects function. Go read its description for information about how it's used.
  • Once you have the convex hull, check the size of the defects. 4 of them should be approximately the same size (cause the fingers are the same length). If that's the case, you have your open hand giving you a high five.


See my answer to this question - there is no straightforward, easy solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜