-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Hierarchy (CV_RETR_TREE) in findContours #4363
Copy link
Copy link
Closed
Labels
Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/https://opencv.org/opencv-hackathon-starts-next-week/auto-transferredbugcategory: imgproc
Milestone
Description
Transferred from http://code.opencv.org/issues/1948
|| Hervé Locteau on 2012-05-16 15:16
|| Priority: Normal
|| Affected: None
|| Category: imgproc, video
|| Tracker: Bug
|| Difficulty: None
|| PR: None
|| Platform: None / None
Hierarchy (CV_RETR_TREE) in findContours
The findContours function may deliver bad structural information on the attached image.
The call leads to this sub hierarchy (id of parent ; id of first child ; id of next ; id of previous) :
* contour 139 : -1 ; 140 ; 138 ; 149
* contour 140 : 139 ; 141 ; -1 ; 146
* contour 141 : 140 ; -1 ; -1 ; 142
* contour 142 : 140 ; -1 ; 141 ; 143
* contour 143 : 140 ; -1 ; 142 ; 144
* contour 144 : 140 ; -1 ; 143 ; 145
* contour 145 : 140 ; -1 ; 144 ; -1
while we may expect :
* contour 139 has no child
* contours 142, 143, 144 and 145 have no parent
Notes
# the contour 140 is a hole touching the outer boundary of the connected component's outer contour (139).
# removing any connected component in the image leads to a correct hierarchy
@
cv::Mat img = cv::imread ( "debug_e.png", 0) ;
std::vector< std::vector< cv::Point > > edges_cc ;
std::vector< cv::Vec4i > tree_cc ;
cv::findContours( img, edges_cc, tree_cc, CV_RETR_TREE, CV_CHAIN_APPROX_NONE ) </pre>
@
My configuration file is :
<pre>
General configuration for OpenCV 2.4.0 =====================================
Version control: svn:8318
Platform:
Host: Linux 3.0.0-19-generic x86_64
CMake: 2.8.5
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: Release
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 4.6.1)
C++ flags (Release): -Wall -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -Wall -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -ggdb3
C Compiler: /usr/bin/gcc
C flags (Release): -Wall -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -Wall -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG -ggdb3
Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4)
JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 62)
PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46)
TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42)
JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
OpenEXR: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
Other third-party libraries:
Use IPP: NO
Use TBB: NO
Use Cuda: NO
Use Eigen: NO
Use Clp: NO
</pre>
History
Andrey Kamaev on 2012-05-17 11:03
- Target version deleted (2.4.1)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Hackathonhttps://opencv.org/opencv-hackathon-starts-next-week/https://opencv.org/opencv-hackathon-starts-next-week/auto-transferredbugcategory: imgproc