Home > Software engineering >  How do I lock separate outline
How do I lock separate outline

Time:10-11

The great god, I want to ask is, I'm in a containing multiple geometric shapes can get their profile pictures, but how do I lock in a particular to judge the outline of the outline of the graphics is a what type of graphics (triangles), for example,

CodePudding user response:

 
//get contour
STD: : vector Contours.
//get outline:
FindContours (image, image//
Contours,//contour point
//contains images topology information (optional parameters, there is no option)
CV_RETR_EXTERNAL,//for contour method (here for peripheral contour)
CV_CHAIN_APPROX_NONE);//Outlines approximate method (there is no approximation, access to all contour)
//print the contour information
STD: : cout<& lt;" In peripheral outline: "& lt; STD: : vector : : const_iterator itContours=contours. The begin ();
For (; ItContours!=contours. The end (); + + itContours)
{
STD: : cout<& lt;" Each contour length: "& lt; }



FindContours (image contours, CV_RETR_EXTERNAL CV_CHAIN_APPROX_NONE);
IndContours (image, image//
Contours,//contour point
//contains images topology information (optional parameters, there is no option)
CV_RETR_EXTERNAL,//for contour method (here for peripheral contour)
CV_CHAIN_APPROX_NONE);//Outlines approximate method (there is no approximation, access to all contour)

Notice the outline storage format for STD: : vector , he described the whole contour is composed of several outline in a certain order, and each contour point is in order,

And then you can according to the order to judge,

CodePudding user response:

Involved in pattern recognition and artificial intelligence,
  • Related