0

I successfully could find hand contour thanks to findContour function in openCV and by setting some arguments. But I do not understand how mathematically openCV can find outer contour of hand? I know that it saves points in an array, but how it uses the hand's points to join them? My question is obviously about the concept behind this function and hierarchy settings. Note that in the case of hand, we do not need to find all the contours, so the first hierarchy will actually work. I really appreciate you answering this question. Thank you all

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87
Maryam
  • 109
  • 8
  • `findContours` doesn't find _hands_. It just _puts togheter_ (see "freeman chain") connected pixels of a binary image obtained trough binarization (see "edge detection", "thresholds", etc...) So, what's the question really? – Miki Aug 30 '16 at 09:47
  • You're definietly right. But I used it to find the contour of hand, since in my case the object of interset is hand. and I needed hand's contour to extract some features from it. I have initially provided a binary theresholded image of hand and tried to find hand's contour by using this function. – Maryam Aug 30 '16 at 09:52
  • The question is "how" it finds the contour of object, and in my case how it finds contour of hand, how it uses the array of (x, y) points to create a bondary of hand? – Maryam Aug 30 '16 at 09:54
  • 1
    conceptually it uses the freeman chain code, in practice it uses more advanced methods. You can check the details in the [source code](https://github.com/opencv/opencv/blob/master/modules/imgproc/src/contours.cpp#L1704) – Miki Aug 30 '16 at 09:57
  • Yes, I checked the source code but it is a long code and I couldn't get the concept. – Maryam Aug 30 '16 at 10:17
  • Corresponding reference for [cv::findContours](http://docs.opencv.org/3.1.0/d3/dc0/group__imgproc__shape.html#ga17ed9f5d79ae97bd4c7cf18403e1689a): [Topological structural analysis of digitized binary images by border following](http://docs.opencv.org/3.1.0/d0/de3/citelist.html#CITEREF_Suzuki85). – Catree Sep 01 '16 at 18:44
  • Possible duplicate of [how does cvFindContours work?](http://stackoverflow.com/questions/8701248/how-does-cvfindcontours-work) and [What is the algorithm that opencv uses for finding contours?](http://stackoverflow.com/questions/10427474/what-is-the-algorithm-that-opencv-uses-for-finding-contours). Have a look at the provided reference: Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following. CVGIP 30 1, pp 32-46 (1985) – David Stutz Sep 05 '16 at 13:00

0 Answers0