diff --git a/modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp b/modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp index 375bced2b..adfbf543b 100644 --- a/modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp +++ b/modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp @@ -141,10 +141,10 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src, * @brief Calculates coordinates of line segment corresponded by point in Hough space. * @param houghPoint Point in Hough space. * @param srcImgInfo The source (input) image of Hough transform. -* @param line Coordinates of line segment corresponded by point in Hough space. * @param angleRange The part of Hough space where point is situated, see cv::AngleRangeOption * @param makeSkew Specifies to do or not to do image skewing, see cv::HoughDeskewOption * @param rules Specifies strictness of line segment calculating, see cv::RulesOption +* @retval [Vec4i] Coordinates of line segment corresponded by point in Hough space. * @remarks If rules parameter set to RO_STRICT then returned line cut along the border of source image. * @remarks If rules parameter set to RO_WEAK then in case of point, which belongs @@ -152,9 +152,8 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src, * * The function calculates coordinates of line segment corresponded by point in Hough space. */ -CV_EXPORTS_W void HoughPoint2Line( const Point &houghPoint, +CV_EXPORTS_W Vec4i HoughPoint2Line(const Point &houghPoint, InputArray srcImgInfo, - Vec4i &line, int angleRange = ARO_315_135, int makeSkew = HDO_DESKEW, int rules = RO_IGNORE_BORDERS ); diff --git a/modules/ximgproc/samples/fast_hough_transform.cpp b/modules/ximgproc/samples/fast_hough_transform.cpp index 13584fa9e..ac34932de 100644 --- a/modules/ximgproc/samples/fast_hough_transform.cpp +++ b/modules/ximgproc/samples/fast_hough_transform.cpp @@ -194,9 +194,7 @@ bool getLocalExtr(vector &lines, for (size_t i = 0; i < weightedPoints.size(); ++i) { - Vec4i houghLine(0, 0, 0, 0); - HoughPoint2Line(weightedPoints[i].second, src, houghLine); - lines.push_back(houghLine); + lines.push_back(HoughPoint2Line(weightedPoints[i].second, src)); } return true; } diff --git a/modules/ximgproc/src/fast_hough_transform.cpp b/modules/ximgproc/src/fast_hough_transform.cpp index ec968a628..f38fcf4a4 100644 --- a/modules/ximgproc/src/fast_hough_transform.cpp +++ b/modules/ximgproc/src/fast_hough_transform.cpp @@ -835,12 +835,11 @@ static void crossSegments(Point &point, point.y = cvRound(line1.u.y + mul * (line1.v.y - line1.u.y)); } -void HoughPoint2Line(const Point &houghPoint, - InputArray srcImgInfo, - Vec4i &line, - int angleRange, - int makeSkew, - int rules) +Vec4i HoughPoint2Line(const Point &houghPoint, + InputArray srcImgInfo, + int angleRange, + int makeSkew, + int rules) { Mat srcImgInfoMat = srcImgInfo.getMat(); @@ -907,8 +906,7 @@ void HoughPoint2Line(const Point &houghPoint, if (!ret) { - line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); - return; + return Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); } if (rules & RO_IGNORE_BORDERS) @@ -933,8 +931,7 @@ void HoughPoint2Line(const Point &houghPoint, break; } - line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); - return; + return Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); } Point minIntersectPoint(0, 0); @@ -1020,7 +1017,7 @@ void HoughPoint2Line(const Point &houghPoint, break; } - line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); + return Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); } //----------------------------------------------------------------------------- diff --git a/modules/ximgproc/test/test_fast_hough_transform.cpp b/modules/ximgproc/test/test_fast_hough_transform.cpp index c94117485..0de981acd 100644 --- a/modules/ximgproc/test/test_fast_hough_transform.cpp +++ b/modules/ximgproc/test/test_fast_hough_transform.cpp @@ -286,9 +286,8 @@ int TestFHT::validate_line(Mat const& fht, { Point fht_max(-1, -1); minMaxLoc(fht_channels[ch], 0, 0, 0, &fht_max); - Vec4i src_line; - HoughPoint2Line(fht_max, src, src_line, - ARO_315_135, HDO_DESKEW, RO_STRICT); + Vec4i src_line = HoughPoint2Line(fht_max, src, + ARO_315_135, HDO_DESKEW, RO_STRICT); double const a = src_line[1] - src_line[3]; double const b = src_line[2] - src_line[0];