Contour compare using OpenCV(source code), cvFindContours, cvMatchShapes

There is shape match function in the OpenCV.
The function name is cvMatchShapes.
This function compares two contours.
If two contours is same, the function returns 0.
conversely, the value of return is larger, more shape different.
So, we use threshold to decide these pair is similar or not.


 






code start

code end

#findcontour, #contour, #compare


source coude

Comments

  1. Anonymous30/5/13 01:35

    you have to free storage like that

    cvReleaseMemStorage(&storage);

    ReplyDelete
  2. Good point, thank you very much.
    ^^

    ReplyDelete
  3. This is really helpful. What if the size of the contour is smaller or larger than the template contour but the shape is the same? Do you any idea how it will be the same(0)?

    ReplyDelete
  4. I will check the question, and upload the solution soon.
    Thank you.

    ReplyDelete
  5. is there some answer for the above question.
    I am using the above method to find the difference in a character image.
    so if the font is bigger, how can we handle this.
    Please let me know if you find some answers.
    Thanks in advance

    ReplyDelete
    Replies
    1. I am interesting in your source code, but can not download them. Can you help me?

      Delete

Post a Comment

Popular posts from this blog

OpenCV Stitching example (Stitcher class, Panorama)

(OpenCV Study) Background subtractor MOG, MOG2, GMG example source code (BackgroundSubtractorMOG, BackgroundSubtractorMOG2, BackgroundSubtractorGMG)

Example source code of extract HOG feature from images, save descriptor values to xml file, using opencv (using HOGDescriptor )

Real-time N camera stitching Class.

8 point algorithm (Matlab source code) / The method to get the Fundamental Matrix and the Essential matrix

Optical Flow sample source code using OpenCV

Video Stabilization example source code, (using cvFindHomography, cvWarpPerspective functions in openCV)

(OpenCV Study) calcOpticalFlowFarneback example source code ( dense optical flow )

yuv422(YUYV) to RGB and RGB to yuv422(YUYV), (Using OpenCV and TBB)

(C, C++) TinyXML , xml read & write