Skip to content

Commit 478baf9

Browse files
goldstar616alalek
authored andcommitted
Merge pull request #981 from goldstar616:master
issue #980 resolves - Some module has a round error similar to #975. (#981) * round function changes to cvRound Minor changes to fix lower visual studio version build errors. * round function changes to cvRound Minor changes to fix lower visual studio version build errors. * round function changes to cvRound Minor changes to fix lower visual studio version build errors.
1 parent f2c324a commit 478baf9

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

modules/text/src/ocr_beamsearch_decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ OCRBeamSearchClassifierCNN::OCRBeamSearchClassifierCNN (const string& filename)
566566

567567
nr_feature = weights.rows;
568568
nr_class = weights.cols;
569-
patch_size = (int)round(sqrt((float)kernels.cols));
569+
patch_size = cvRound(sqrt((float)kernels.cols));
570570
window_size = 4*patch_size;
571571
step_size = 4;
572572
quad_size = 12;

modules/text/src/ocr_hmm_decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ OCRHMMClassifierCNN::OCRHMMClassifierCNN (const string& filename)
982982

983983
nr_feature = weights.rows;
984984
nr_class = weights.cols;
985-
patch_size = (int)round(sqrt((float)kernels.cols));
985+
patch_size = cvRound(sqrt((float)kernels.cols));
986986
// algorithm internal parameters
987987
window_size = 32;
988988
num_quads = 25;

modules/ximgproc/src/fast_line_detector.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ void FastLineDetectorImpl::drawSegments(InputOutputArray _image, InputArray line
182182
getAngle(seg);
183183
double ang = (double)seg.angle;
184184
Point2i p1;
185-
p1.x = (int)round(seg.x2 - gap*cos(arrow_angle * CV_PI / 180.0 + ang));
186-
p1.y = (int)round(seg.y2 - gap*sin(arrow_angle * CV_PI / 180.0 + ang));
185+
p1.x = cvRound(seg.x2 - gap*cos(arrow_angle * CV_PI / 180.0 + ang));
186+
p1.y = cvRound(seg.y2 - gap*sin(arrow_angle * CV_PI / 180.0 + ang));
187187
pointInboardTest(_image.getMatRef(), p1);
188-
line(_image.getMatRef(), Point((int)round(seg.x2), (int)round(seg.y2)), p1, Scalar(0,0,255), 1);
188+
line(_image.getMatRef(), Point(cvRound(seg.x2), cvRound(seg.y2)), p1, Scalar(0,0,255), 1);
189189
}
190190
}
191191
}
@@ -717,14 +717,14 @@ void FastLineDetectorImpl::drawSegment(Mat& mat, const SEGMENT& seg, Scalar bgr,
717717
double arrow_angle = 30.0;
718718

719719
Point2i p1;
720-
p1.x = (int)round(seg.x2 - gap*cos(arrow_angle * CV_PI / 180.0 + ang));
721-
p1.y = (int)round(seg.y2 - gap*sin(arrow_angle * CV_PI / 180.0 + ang));
720+
p1.x = cvRound(seg.x2 - gap*cos(arrow_angle * CV_PI / 180.0 + ang));
721+
p1.y = cvRound(seg.y2 - gap*sin(arrow_angle * CV_PI / 180.0 + ang));
722722
pointInboardTest(mat, p1);
723723

724-
line(mat, Point((int)round(seg.x1), (int)round(seg.y1)),
725-
Point((int)round(seg.x2), (int)round(seg.y2)), bgr, thickness, 1);
724+
line(mat, Point(cvRound(seg.x1), cvRound(seg.y1)),
725+
Point(cvRound(seg.x2), cvRound(seg.y2)), bgr, thickness, 1);
726726
if(directed)
727-
line(mat, Point((int)round(seg.x2), (int)round(seg.y2)), p1, bgr, thickness, 1);
727+
line(mat, Point(cvRound(seg.x2), cvRound(seg.y2)), p1, bgr, thickness, 1);
728728
}
729729
} // namespace cv
730730
} // namespace ximgproc

0 commit comments

Comments
 (0)