mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 17:07:39 +08:00
Fix weird boolean conditions
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -99,10 +99,8 @@ int main( int argc, const char** argv )
|
|||||||
if (detectRegion)
|
if (detectRegion)
|
||||||
alpr.setDetectRegion(detectRegion);
|
alpr.setDetectRegion(detectRegion);
|
||||||
|
|
||||||
if (strcmp(templateRegion.c_str(), "") != 0)
|
if (templateRegion.empty() == false)
|
||||||
{
|
|
||||||
alpr.setDefaultRegion(templateRegion);
|
alpr.setDefaultRegion(templateRegion);
|
||||||
}
|
|
||||||
|
|
||||||
if (alpr.isLoaded() == false)
|
if (alpr.isLoaded() == false)
|
||||||
{
|
{
|
||||||
@@ -110,7 +108,7 @@ int main( int argc, const char** argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(filename.c_str(), "webcam") == 0)
|
if (filename == "webcam")
|
||||||
{
|
{
|
||||||
int framenum = 0;
|
int framenum = 0;
|
||||||
cv::VideoCapture cap(0);
|
cv::VideoCapture cap(0);
|
||||||
@@ -120,7 +118,7 @@ int main( int argc, const char** argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (cap.read(frame) == true)
|
while (cap.read(frame))
|
||||||
{
|
{
|
||||||
detectandshow(&alpr, frame, "", outputJson);
|
detectandshow(&alpr, frame, "", outputJson);
|
||||||
cv::waitKey(1);
|
cv::waitKey(1);
|
||||||
@@ -137,9 +135,9 @@ int main( int argc, const char** argv )
|
|||||||
cap.open(filename);
|
cap.open(filename);
|
||||||
cap.set(CV_CAP_PROP_POS_MSEC, seektoms);
|
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);
|
cv::imwrite(LAST_VIDEO_STILL_LOCATION, frame);
|
||||||
}
|
}
|
||||||
|
@@ -279,7 +279,7 @@ void showDashboard(vector<Mat> images, vector<bool> selectedImages, int selected
|
|||||||
{
|
{
|
||||||
rectangle(imgCopy, Point(1,1), Point(imgCopy.size().width - 1, imgCopy.size().height -1), Scalar(0, 255, 0), 1);
|
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);
|
rectangle(imgCopy, Point(2,2), Point(imgCopy.size().width - 2, imgCopy.size().height -2), Scalar(255, 0, 0), 1);
|
||||||
}
|
}
|
||||||
|
@@ -651,7 +651,7 @@ vector< bool > CharacterAnalysis::filterContourHoles(vector< vector< Point > > c
|
|||||||
|
|
||||||
int parentIndex = hierarchy[i][3];
|
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
|
// this contour is a child of an already identified contour. REMOVE it
|
||||||
if (this->config->debugCharAnalysis)
|
if (this->config->debugCharAnalysis)
|
||||||
|
@@ -424,8 +424,7 @@ vector<Rect> CharacterSegmenter::get1DHits(Mat img, int yOffset)
|
|||||||
curSegmentLength++;
|
curSegmentLength++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isOn == false && onSegment == true) ||
|
if (onSegment && (isOn == false || (col == img.cols - 1)))
|
||||||
(col == img.cols - 1 && onSegment == true))
|
|
||||||
{
|
{
|
||||||
// A segment just ended or we're at the very end of the row and we're on a segment
|
// 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);
|
Point topLeft = Point(col - curSegmentLength, top.getPointAt(col - curSegmentLength) - 1);
|
||||||
@@ -1054,8 +1053,7 @@ int CharacterSegmenter::getLongestBlobLengthBetweenLines(Mat img, int col)
|
|||||||
wasbetweenLines = true;
|
wasbetweenLines = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isOn == false && onSegment == true) ||
|
if (onSegment && (isOn == false || (row == img.rows - 1)))
|
||||||
(row == img.rows - 1 && onSegment == true))
|
|
||||||
{
|
{
|
||||||
if (wasbetweenLines && curSegmentLength > longestBlobLength)
|
if (wasbetweenLines && curSegmentLength > longestBlobLength)
|
||||||
longestBlobLength = curSegmentLength;
|
longestBlobLength = curSegmentLength;
|
||||||
|
@@ -363,7 +363,7 @@ RecognitionResult FeatureMatcher::recognize( const Mat& queryImg, bool drawOnIma
|
|||||||
drawKeypoints( queryImg, queryKeypoints, tmpImg, CV_RGB(185, 0, 0), DrawMatchesFlags::DEFAULT );
|
drawKeypoints( queryImg, queryKeypoints, tmpImg, CV_RGB(185, 0, 0), DrawMatchesFlags::DEFAULT );
|
||||||
drawKeypoints( tmpImg, positiveMatches, *outputImage, CV_RGB(0, 255, 0), DrawMatchesFlags::DEFAULT );
|
drawKeypoints( tmpImg, positiveMatches, *outputImage, CV_RGB(0, 255, 0), DrawMatchesFlags::DEFAULT );
|
||||||
|
|
||||||
if (result.haswinner == true)
|
if (result.haswinner)
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << result.winner << " (" << result.confidence << "%)";
|
out << result.winner << " (" << result.confidence << "%)";
|
||||||
|
Reference in New Issue
Block a user