블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
  • total
  • today
  • yesterday

Category

OpenCV: cvFindContours( )

cvFindContours()
int cvFindContours(CvArr* image, CvMemStorage* storage, CvSeq** first_contour, int header_size=sizeof(CvContour), int mode=CV_RETR_LIST, int method=CV_CHAIN_APPROX_SIMPLE, CvPoint offset=cvPoint(0, 0))

Finds the contours in a binary image.

Parameters:
  • image – The source, an 8-bit single channel image. Non-zero pixels are treated as 1’s, zero pixels remain 0’s - the image is treated as binary . To get such a binary image from grayscale, one may use Threshold , AdaptiveThreshold or Canny . The function modifies the source image’s content
  • storage – Container of the retrieved contours
  • first_contour – Output parameter, will contain the pointer to the first outer contour
  • header_size – Size of the sequence header, \ge \texttt{sizeof(CvChain)} if \texttt{method} =\texttt{CV\_CHAIN\_CODE} , and \ge \texttt{sizeof(CvContour)} otherwise
  • mode

    Retrieval mode

    • CV_RETR_EXTERNAL retrives only the extreme outer contours
    • CV_RETR_LIST retrieves all of the contours and puts them in the list
    • CV_RETR_CCOMP retrieves all of the contours and organizes them into a two-level hierarchy: on the top level are the external boundaries of the components, on the second level are the boundaries of the holes
    • CV_RETR_TREE retrieves all of the contours and reconstructs the full hierarchy of nested contours
  • method

    Approximation method (for all the modes, except CV_LINK_RUNS , which uses built-in approximation)

    • CV_CHAIN_CODE outputs contours in the Freeman chain code. All other methods output polygons (sequences of vertices)
    • CV_CHAIN_APPROX_NONE translates all of the points from the chain code into points
    • CV_CHAIN_APPROX_SIMPLE compresses horizontal, vertical, and diagonal segments and leaves only their end points
    • CV_CHAIN_APPROX_TC89_L1,CV_CHAIN_APPROX_TC89_KCOS applies one of the flavors of the Teh-Chin chain approximation algorithm.
    • CV_LINK_RUNS uses a completely different contour retrieval algorithm by linking horizontal segments of 1’s. Only the CV_RETR_LIST retrieval mode can be used with this method.
  • offset – Offset, by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context



Learning OpenCV: Chater 8. Contours: Contour Finding
: 234p
"the concept of a contour tree"


Suzuki, M. (1985) Evapotranspiration Estimates of Forested Watersheds in Japan Using the Short-time Period Water-budget Methods. Journal of Japanese Forest Society, 67: 115-125. (in Japanese with English summary)


posted by maetel