Merge pull request #74 from twelve17/gray_mat

Detect and use source grayscale mat if applicable.
This commit is contained in:
Matthew Hill
2015-01-06 22:31:55 -05:00
2 changed files with 19 additions and 4 deletions

View File

@@ -49,7 +49,15 @@ namespace alpr
{
Mat frame_gray;
if (frame.channels() > 2)
{
cvtColor( frame, frame_gray, CV_BGR2GRAY );
}
else
{
frame_gray = frame;
}
vector<PlateRegion> detectedRegions;
for (int i = 0; i < regionsOfInterest.size(); i++)

View File

@@ -9,7 +9,14 @@ namespace alpr
PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config)
{
this->colorImg = colorImage;
if (colorImage.channels() > 2)
{
cvtColor(this->colorImg, this->grayImg, CV_BGR2GRAY);
}
else
{
this->grayImg = colorImage;
}
this->regionOfInterest = regionOfInterest;
this->config = config;