mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-09 04:20:04 +08:00
Fixed segfault in classifychars caused by rotation
This commit is contained in:
@@ -105,6 +105,9 @@ int main( int argc, const char** argv )
|
|||||||
cout << "\tESC/Ent/Space -- Back to plate selection" << endl;
|
cout << "\tESC/Ent/Space -- Back to plate selection" << endl;
|
||||||
|
|
||||||
Config config(country);
|
Config config(country);
|
||||||
|
config.debugGeneral = true;
|
||||||
|
config.debugCharAnalysis = true;
|
||||||
|
config.debugCharSegmenter = true;
|
||||||
OCR ocr(&config);
|
OCR ocr(&config);
|
||||||
|
|
||||||
if (DirectoryExists(inDir.c_str()))
|
if (DirectoryExists(inDir.c_str()))
|
||||||
@@ -135,20 +138,6 @@ int main( int argc, const char** argv )
|
|||||||
|
|
||||||
CharacterAnalysis regionizer(&pipeline_data);
|
CharacterAnalysis regionizer(&pipeline_data);
|
||||||
|
|
||||||
if (abs(pipeline_data.textLines[0].angle) > 4)
|
|
||||||
{
|
|
||||||
// Rotate image:
|
|
||||||
Mat rotated(frame.size(), frame.type());
|
|
||||||
Mat rot_mat( 2, 3, CV_32FC1 );
|
|
||||||
Point center = Point( frame.cols/2, frame.rows/2 );
|
|
||||||
|
|
||||||
rot_mat = getRotationMatrix2D( center, pipeline_data.textLines[0].angle, 1.0 );
|
|
||||||
warpAffine( frame, rotated, rot_mat, frame.size() );
|
|
||||||
|
|
||||||
rotated.copyTo(frame);
|
|
||||||
pipeline_data.crop_gray = rotated;
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterSegmenter charSegmenter(&pipeline_data);
|
CharacterSegmenter charSegmenter(&pipeline_data);
|
||||||
|
|
||||||
//ocr.cleanCharRegions(charSegmenter.thresholds, charSegmenter.characters);
|
//ocr.cleanCharRegions(charSegmenter.thresholds, charSegmenter.characters);
|
||||||
|
Reference in New Issue
Block a user