mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
Merge pull request #74 from twelve17/gray_mat
Detect and use source grayscale mat if applicable.
This commit is contained in:
@@ -49,7 +49,15 @@ namespace alpr
|
|||||||
{
|
{
|
||||||
|
|
||||||
Mat frame_gray;
|
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;
|
vector<PlateRegion> detectedRegions;
|
||||||
for (int i = 0; i < regionsOfInterest.size(); i++)
|
for (int i = 0; i < regionsOfInterest.size(); i++)
|
||||||
@@ -128,4 +136,4 @@ namespace alpr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,11 +5,18 @@ using namespace std;
|
|||||||
|
|
||||||
namespace alpr
|
namespace alpr
|
||||||
{
|
{
|
||||||
|
|
||||||
PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config)
|
PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config)
|
||||||
{
|
{
|
||||||
this->colorImg = colorImage;
|
this->colorImg = colorImage;
|
||||||
cvtColor(this->colorImg, this->grayImg, CV_BGR2GRAY);
|
if (colorImage.channels() > 2)
|
||||||
|
{
|
||||||
|
cvtColor(this->colorImg, this->grayImg, CV_BGR2GRAY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->grayImg = colorImage;
|
||||||
|
}
|
||||||
|
|
||||||
this->regionOfInterest = regionOfInterest;
|
this->regionOfInterest = regionOfInterest;
|
||||||
this->config = config;
|
this->config = config;
|
||||||
|
Reference in New Issue
Block a user