Fix grayscale images recogntion

This commit is contained in:
Serge Smelov
2016-01-11 23:26:57 +03:00
parent 28e366a16c
commit 6d5ab9c651

View File

@@ -89,8 +89,11 @@ namespace alpr
cv::Mat color_transmtx = cv::getPerspectiveTransform(projectedPoints, deskewed_points); cv::Mat color_transmtx = cv::getPerspectiveTransform(projectedPoints, deskewed_points);
cv::warpPerspective(pipeline_data->colorImg, pipeline_data->color_deskewed, color_transmtx, pipeline_data->color_deskewed.size()); cv::warpPerspective(pipeline_data->colorImg, pipeline_data->color_deskewed, color_transmtx, pipeline_data->color_deskewed.size());
// Make a grayscale copy as well for faster processing downstream if (pipeline_data->color_deskewed.channels() > 2)
cv::cvtColor(pipeline_data->color_deskewed, pipeline_data->crop_gray, CV_BGR2GRAY); {
// Make a grayscale copy as well for faster processing downstream
cv::cvtColor(pipeline_data->color_deskewed, pipeline_data->crop_gray, CV_BGR2GRAY);
}
if (this->config->debugGeneral) if (this->config->debugGeneral)
@@ -102,7 +105,7 @@ namespace alpr
// to match the newly deskewed license plate crop // to match the newly deskewed license plate crop
vector<TextLine> newLines; vector<TextLine> newLines;
for (unsigned int i = 0; i < pipeline_data->textLines.size(); i++) for (unsigned int i = 0; i < pipeline_data->textLines.size(); i++)
{ {
vector<Point2f> textArea = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].textArea); vector<Point2f> textArea = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].textArea);
vector<Point2f> linePolygon = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].linePolygon); vector<Point2f> linePolygon = imgTransform.transformSmallPointsToBigImage(pipeline_data->textLines[i].linePolygon);