V
V
VitonZizu2014-08-21 11:16:30
.NET
VitonZizu, 2014-08-21 11:16:30

How to select only outer contours with OpenCV?

Guys, I use OpenCV in my program, I find contours perfectly, BUT both external and internal ones get there. I know that only external ones can be distinguished, I will be grateful for a hint?

CvContourScanner scanner = new CvContourScanner(gray, storage, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple);
                        
foreach (CvSeq<CvPoint> c in scanner) 
{
etc....
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor, 2014-08-25
@victor1234

In general, the findContours function has a mode parameter that allows you to pass a hierarchy of contours.
If you have your own function, looking at the findContours sorts can help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question