Detect and use source grayscale mat if applicable.

This commit is contained in:
twelve17
2015-01-06 14:36:24 +00:00
parent bc0c569f39
commit 97966fb8a6
2 changed files with 19 additions and 4 deletions

View File

@@ -49,7 +49,15 @@ namespace alpr
{
Mat frame_gray;
cvtColor( frame, frame_gray, CV_BGR2GRAY );
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++)
@@ -128,4 +136,4 @@ namespace alpr
}
}
}