mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 08:56:55 +08:00
Update detectormorph.cpp
cosmetic fixes
This commit is contained in:
@@ -129,14 +129,14 @@ namespace alpr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Now prunning based on checking all candidate plates for a min/max number of blobsc
|
//Now prunning based on checking all candidate plates for a min/max number of blobsc
|
||||||
Mat img_crop, img_crop_b, img_crop_th, img_crop_th_inv;
|
Mat img_crop, img_crop_b, img_crop_th, img_crop_th_inv;
|
||||||
vector< vector< Point> > plateBlobs;
|
vector< vector< Point> > plateBlobs;
|
||||||
vector< vector< Point> > plateBlobsInv;
|
vector< vector< Point> > plateBlobsInv;
|
||||||
double thresholds[] = { 10, 40, 80, 120, 160, 200, 240 };
|
double thresholds[] = { 10, 40, 80, 120, 160, 200, 240 };
|
||||||
const int num_thresholds = 7;
|
const int num_thresholds = 7;
|
||||||
int numValidChars = 0;
|
int numValidChars = 0;
|
||||||
Mat rotated;
|
Mat rotated;
|
||||||
for (int i = 0; i < rects.size(); i++) {
|
for (int i = 0; i < rects.size(); i++) {
|
||||||
RotatedRect PlateRect = rects[i];
|
RotatedRect PlateRect = rects[i];
|
||||||
Size rect_size = PlateRect.size;
|
Size rect_size = PlateRect.size;
|
||||||
|
|
||||||
@@ -152,8 +152,7 @@ namespace alpr {
|
|||||||
waitKey(0);
|
waitKey(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int z = 0; z < num_thresholds; z++)
|
for (int z = 0; z < num_thresholds; z++) {
|
||||||
{
|
|
||||||
|
|
||||||
cv::threshold(img_crop, img_crop_th, thresholds[z], 255, cv::THRESH_BINARY);
|
cv::threshold(img_crop, img_crop_th, thresholds[z], 255, cv::THRESH_BINARY);
|
||||||
cv::threshold(img_crop, img_crop_th_inv, thresholds[z], 255, cv::THRESH_BINARY_INV);
|
cv::threshold(img_crop, img_crop_th_inv, thresholds[z], 255, cv::THRESH_BINARY_INV);
|
||||||
@@ -179,8 +178,7 @@ namespace alpr {
|
|||||||
numValidChars++;
|
numValidChars++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < numBlobsInv; j++)
|
for (int j = 0; j < numBlobsInv; j++) {
|
||||||
{
|
|
||||||
cv::Rect r0 = cv::boundingRect(cv::Mat(plateBlobsInv[j]));
|
cv::Rect r0 = cv::boundingRect(cv::Mat(plateBlobsInv[j]));
|
||||||
if (ValidateCharAspect(r0, idealAspect))
|
if (ValidateCharAspect(r0, idealAspect))
|
||||||
numValidChars++;
|
numValidChars++;
|
||||||
|
Reference in New Issue
Block a user