Don't use "new" when it's not needed

This commit is contained in:
Philippe Vaucher
2014-04-02 15:34:32 +02:00
parent 526f777d6a
commit b548734fff

View File

@@ -104,8 +104,8 @@ int main( int argc, const char** argv )
cout << "\t[0-9A-Z] -- Identify a character (saves the image)" << endl; cout << "\t[0-9A-Z] -- Identify a character (saves the image)" << endl;
cout << "\tESC/Ent/Space -- Back to plate selection" << endl; cout << "\tESC/Ent/Space -- Back to plate selection" << endl;
Config* config = new Config(country); Config config(country);
OCR ocr(config); OCR ocr(&config);
if (DirectoryExists(inDir.c_str())) if (DirectoryExists(inDir.c_str()))
{ {
@@ -120,7 +120,7 @@ int main( int argc, const char** argv )
string fullpath = inDir + "/" + files[i]; string fullpath = inDir + "/" + files[i];
cout << fullpath << endl; cout << fullpath << endl;
frame = imread( fullpath.c_str() ); frame = imread( fullpath.c_str() );
resize(frame, frame, Size(config->ocrImageWidthPx, config->ocrImageHeightPx)); resize(frame, frame, Size(config.ocrImageWidthPx, config.ocrImageHeightPx));
imshow ("Original", frame); imshow ("Original", frame);
@@ -130,7 +130,7 @@ int main( int argc, const char** argv )
statecode[2] = '\0'; statecode[2] = '\0';
string statecodestr(statecode); string statecodestr(statecode);
CharacterRegion regionizer(frame, config); CharacterRegion regionizer(frame, &config);
if (abs(regionizer.getTopLine().angle) > 4) if (abs(regionizer.getTopLine().angle) > 4)
{ {
@@ -145,7 +145,7 @@ int main( int argc, const char** argv )
rotated.copyTo(frame); rotated.copyTo(frame);
} }
CharacterSegmenter charSegmenter(frame, regionizer.thresholdsInverted(), config); CharacterSegmenter charSegmenter(frame, regionizer.thresholdsInverted(), &config);
//ocr.cleanCharRegions(charSegmenter.thresholds, charSegmenter.characters); //ocr.cleanCharRegions(charSegmenter.thresholds, charSegmenter.characters);