Fix weird boolean conditions

This commit is contained in:
Philippe Vaucher
2014-03-24 12:41:23 +01:00
parent d24ed44f83
commit c406cc6e0b
5 changed files with 10 additions and 14 deletions

View File

@@ -424,8 +424,7 @@ vector<Rect> 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;