2012-01-12 3 views
12

मैं ओपनसीवी के सीवीएफआईंडकंटोर फ़ंक्शन का उपयोग कर रहा हूं और इसमें एक पैरामीटर है RETR_TYPE का मतलब रेट्रीवल प्रकार है, इसलिए मुझे CV_RETR_LIST, CV_RETR_TREE, CV_RETR_EXTERNAL के बीच क्या अंतर है?अंतर है?

+0

यहाँ किताब [OpenCV] (http://books.google.co.jp/books के लिए एक लिंक है? आईडी = seAgiOfu2EIC और स्नातकोत्तर = PA236 और रसोई गैस = PA236 और डीक्यू = CV_RETR_LIST, CV_RETR_TREE, CV_RETR_EXTERNAL और स्रोत = बीएल और ओ टी एस = hSF68jiEN9 और sig = EukC6H9XafAm89zOkkw7UiFWvAc & hl = hi & सा = एक्स और Ei = pnQOT87GH-mimQWjn8TDAw और redir_esc = y # v = onepage & q = CV_RETR_LIST% 2CCV_RETR_TREE% 2CCV_RETR_EXTERNAL & f = गलत) जो मतभेद बताते हैं (पृष्ठ 236- 237) –

+1

आप और अधिक पा सकते हैं इस आलेख पर विवरण: http://opencvpython.blogspot.com/2013/01/contours-5-hierarchy.html –

उत्तर

16

the documentation for findContours देखें।

मुख्य अंतर यह है कि लौटा दिया जाता है (एक समोच्च और अगले के बीच संबंधों को दे रही है) hierarchy में है।

  • CV_RETR_EXTERNAL देता है "बाहरी" आकृति, इसलिए अगर आपके पास (माना) एक समोच्च enclosing एक और (संकेंद्रित वृत्तों की तरह), केवल सबसे बाहरी दिया जाता है।
  • CV_RETR_LIST सभी समोच्चों को देता है और hierarchy की गणना करने से भी परेशान नहीं होता है - अच्छा अगर आप केवल समोच्च चाहते हैं और कोई परवाह नहीं है कि कोई दूसरे के अंदर घोंसला है या नहीं।
  • CV_RETR_CCOMP आकृति देता है और उन्हें बाहरी और भीतरी आकृति में आयोजित करता है। हर समोच्च या तो एक वस्तु की रूपरेखा, या किसी अन्य वस्तु (अर्थात छेद) के अंदर एक वस्तु की रूपरेखा है। hierarchy तदनुसार समायोजित किया गया है। यह उपयोगी हो सकता है अगर (कहें) आप सभी छेद ढूंढना चाहते हैं।
  • CV_RETR_TREE आकृति से भरा पदानुक्रम गणना करता है। तो आप कह सकते हैं कि ऑब्जेक्ट 1 ऑब्जेक्ट 2 के भीतर गहरे 4 स्तरों को घोंसला है और ऑब्जेक्ट 3 को 4 स्तर गहरा भी घोंसला है।
0

imgproc.cpp से:

//! mode of the contour retrieval algorithm 
enum RetrievalModes { 
    /** retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for 
    all the contours. */ 
    RETR_EXTERNAL = 0, 
    /** retrieves all of the contours without establishing any hierarchical relationships. */ 
    RETR_LIST  = 1, 
    /** retrieves all of the contours and organizes them into a two-level hierarchy. At the top 
    level, there are external boundaries of the components. At the second level, there are 
    boundaries of the holes. If there is another contour inside a hole of a connected component, it 
    is still put at the top level. */ 
    RETR_CCOMP  = 2, 
    /** retrieves all of the contours and reconstructs a full hierarchy of nested contours.*/ 
    RETR_TREE  = 3, 
    RETR_FLOODFILL = 4 //!< 
}; 

OpenCV 2.4.13