diff --git a/src/main.cpp b/src/main.cpp index 3704a2a..4cc226b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -99,10 +99,8 @@ int main( int argc, const char** argv ) if (detectRegion) alpr.setDetectRegion(detectRegion); - if (strcmp(templateRegion.c_str(), "") != 0) - { + if (templateRegion.empty() == false) alpr.setDefaultRegion(templateRegion); - } if (alpr.isLoaded() == false) { @@ -110,7 +108,7 @@ int main( int argc, const char** argv ) return 1; } - if (strcmp(filename.c_str(), "webcam") == 0) + if (filename == "webcam") { int framenum = 0; cv::VideoCapture cap(0); @@ -120,7 +118,7 @@ int main( int argc, const char** argv ) return 1; } - while (cap.read(frame) == true) + while (cap.read(frame)) { detectandshow(&alpr, frame, "", outputJson); cv::waitKey(1); @@ -137,9 +135,9 @@ int main( int argc, const char** argv ) cap.open(filename); cap.set(CV_CAP_PROP_POS_MSEC, seektoms); - while (cap.read(frame) == true) + while (cap.read(frame)) { - if (SAVE_LAST_VIDEO_STILL == true) + if (SAVE_LAST_VIDEO_STILL) { cv::imwrite(LAST_VIDEO_STILL_LOCATION, frame); } diff --git a/src/misc_utilities/classifychars.cpp b/src/misc_utilities/classifychars.cpp index 8f6aea7..0f88431 100644 --- a/src/misc_utilities/classifychars.cpp +++ b/src/misc_utilities/classifychars.cpp @@ -279,7 +279,7 @@ void showDashboard(vector images, vector selectedImages, int selected { rectangle(imgCopy, Point(1,1), Point(imgCopy.size().width - 1, imgCopy.size().height -1), Scalar(0, 255, 0), 1); } - if (selectedImages[i] == true) + if (selectedImages[i]) { rectangle(imgCopy, Point(2,2), Point(imgCopy.size().width - 2, imgCopy.size().height -2), Scalar(255, 0, 0), 1); } diff --git a/src/openalpr/characteranalysis.cpp b/src/openalpr/characteranalysis.cpp index 3454ca3..fc61860 100644 --- a/src/openalpr/characteranalysis.cpp +++ b/src/openalpr/characteranalysis.cpp @@ -651,7 +651,7 @@ vector< bool > CharacterAnalysis::filterContourHoles(vector< vector< Point > > c int parentIndex = hierarchy[i][3]; - if (parentIndex >= 0 && goodIndices[parentIndex] == true) + if (parentIndex >= 0 && goodIndices[parentIndex]) { // this contour is a child of an already identified contour. REMOVE it if (this->config->debugCharAnalysis) diff --git a/src/openalpr/charactersegmenter.cpp b/src/openalpr/charactersegmenter.cpp index b3d41d9..688760b 100644 --- a/src/openalpr/charactersegmenter.cpp +++ b/src/openalpr/charactersegmenter.cpp @@ -424,8 +424,7 @@ vector CharacterSegmenter::get1DHits(Mat img, int yOffset) curSegmentLength++; } - if ((isOn == false && onSegment == true) || - (col == img.cols - 1 && onSegment == true)) + if (onSegment && (isOn == false || (col == img.cols - 1))) { // A segment just ended or we're at the very end of the row and we're on a segment Point topLeft = Point(col - curSegmentLength, top.getPointAt(col - curSegmentLength) - 1); @@ -1054,8 +1053,7 @@ int CharacterSegmenter::getLongestBlobLengthBetweenLines(Mat img, int col) wasbetweenLines = true; } - if ((isOn == false && onSegment == true) || - (row == img.rows - 1 && onSegment == true)) + if (onSegment && (isOn == false || (row == img.rows - 1))) { if (wasbetweenLines && curSegmentLength > longestBlobLength) longestBlobLength = curSegmentLength; diff --git a/src/openalpr/featurematcher.cpp b/src/openalpr/featurematcher.cpp index fa24e24..268410f 100644 --- a/src/openalpr/featurematcher.cpp +++ b/src/openalpr/featurematcher.cpp @@ -363,7 +363,7 @@ RecognitionResult FeatureMatcher::recognize( const Mat& queryImg, bool drawOnIma drawKeypoints( queryImg, queryKeypoints, tmpImg, CV_RGB(185, 0, 0), DrawMatchesFlags::DEFAULT ); drawKeypoints( tmpImg, positiveMatches, *outputImage, CV_RGB(0, 255, 0), DrawMatchesFlags::DEFAULT ); - if (result.haswinner == true) + if (result.haswinner) { std::ostringstream out; out << result.winner << " (" << result.confidence << "%)";