Question

I want to compare two images using OpenCV. 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.

Was it helpful?

Solution

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):

convexity defects

  • 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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top