Home > other >  Want to know how to according to the aspect ratio to extract the contour
Want to know how to according to the aspect ratio to extract the contour

Time:09-24

License plate recognition (recently doing, but after made several outline, want to have other false license plate profile, want to discrimination, according to the aspect ratio but opencv has this function, if not I write their own can also, but his own writing, is to compile the image as an array, a novice small white urgent,
)

CodePudding user response:

Describe the outline a the Rect type of bounding box, you put the extracted from the Rect, limit the Rect. Width and the Rect. Height line, for example,
Vector Contours.
FindContours (img, contours, CV_RETR_EXTERNAL CV_CHAIN_APPROX_NONE);
for (int i=0; I & lt; Contours. The size (); I++)
{
The Rect r0=boundingRect (Mat (contours [I]));
Float rate=(float) r0. Width/(float) r0. Height;
If (rate constraints)
{}
}

CodePudding user response:

To compared with preset to the Size is ok, is out of range,
  • Related