This should be easy for C ++ developers using OpenCV directly. However, what I'm using is Emgu (the OpenCV shell for .NET), and in the latest version we have a method CvInvoke.FindContoursthat returns void, the output is passed by the parameter reference and is of type VectorOfVectorOfPoint.
Here is a simple call:
CvInvoke.FindContours(inputImage, outputResult, null, RetrType.Tree,
ChainApproxMethod.ChainApproxSimple);
In mode, RetrType.Listwe can simply convert the result to some array of arrays and easily skip all contours. However, here I would like to move along all the contours in the tree. I think that we should do something with our own (insecure) C ++ code here with a pointer (access via the property of the Ptroutput result). But I am wondering if there is a solution more convenient for .NET for this. And even if using a pointer is the only solution, I still don't know how to delve into it Ptrto move around the path tree.
The code examples followed by the Emgu installation have a snippet using CvInvoke.FindContourTreeinstead (and which returns a int[,]).