Commit a02af4a1 authored by xolodilnik's avatar xolodilnik

modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp moved from…

modules/ximgproc/include/opencv2/ximgproc/fast_hough_transform.hpp moved from modules/ximgproc/include/opencv2/ximgproc.hpp
HoughPoint2Line returned Vec4i instead of OutputArray
parent 1bd2aafb
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "ximgproc/edge_filter.hpp" #include "ximgproc/edge_filter.hpp"
#include "ximgproc/structured_edge_detection.hpp" #include "ximgproc/structured_edge_detection.hpp"
#include "ximgproc/seeds.hpp" #include "ximgproc/seeds.hpp"
#include "ximgproc/fast_hough_transform.hpp"
/** @defgroup ximgproc Extended Image Processing /** @defgroup ximgproc Extended Image Processing
@{ @{
......
...@@ -130,7 +130,7 @@ typedef enum { ...@@ -130,7 +130,7 @@ typedef enum {
* The function calculates the fast Hough transform for full, half or quarter * The function calculates the fast Hough transform for full, half or quarter
* range of angles. * range of angles.
*/ */
CV_EXPORTS_W void FastHoughTransform( InputArray src, CV_EXPORTS_W void FastHoughTransform( InputArray src,
OutputArray dst, OutputArray dst,
int dstMatDepth, int dstMatDepth,
int angleRange = ARO_315_135, int angleRange = ARO_315_135,
...@@ -139,9 +139,9 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src, ...@@ -139,9 +139,9 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src,
/** /**
* @brief Calculates coordinates of line segment corresponded by point in Hough space. * @brief Calculates coordinates of line segment corresponded by point in Hough space.
* @param line Coordinates of line segment corresponded by point in Hough space.
* @param houghPoint Point in Hough space. * @param houghPoint Point in Hough space.
* @param srcImgInfo The source (input) image of Hough transform. * @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 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 makeSkew Specifies to do or not to do image skewing, see cv::HoughDeskewOption
* @param rules Specifies strictness of line segment calculating, see cv::RulesOption * @param rules Specifies strictness of line segment calculating, see cv::RulesOption
...@@ -152,12 +152,12 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src, ...@@ -152,12 +152,12 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src,
* *
* The function calculates coordinates of line segment corresponded by point in Hough space. * The function calculates coordinates of line segment corresponded by point in Hough space.
*/ */
CV_EXPORTS_W void HoughPoint2Line( OutputArray line, CV_EXPORTS_W void HoughPoint2Line( const Point &houghPoint,
const Point &houghPoint, InputArray srcImgInfo,
const Mat &srcImgInfo, Vec4i &line,
int angleRange = ARO_315_135, int angleRange = ARO_315_135,
int makeSkew = HDO_DESKEW, int makeSkew = HDO_DESKEW,
int rules = RO_IGNORE_BORDERS ); int rules = RO_IGNORE_BORDERS );
} }// namespace cv::ximgproc } }// namespace cv::ximgproc
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
//M*/ //M*/
#include "perf_precomp.hpp" #include "perf_precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cvtest { namespace cvtest {
......
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
#include <opencv2/ximgproc.hpp> #include <opencv2/ximgproc.hpp>
#include "fast_hough_transform.hpp"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <cstdio> #include <cstdio>
...@@ -197,7 +195,7 @@ bool getLocalExtr(vector<Vec4i> &lines, ...@@ -197,7 +195,7 @@ bool getLocalExtr(vector<Vec4i> &lines,
for (size_t i = 0; i < weightedPoints.size(); ++i) for (size_t i = 0; i < weightedPoints.size(); ++i)
{ {
Vec4i houghLine(0, 0, 0, 0); Vec4i houghLine(0, 0, 0, 0);
HoughPoint2Line(houghLine, weightedPoints[i].second, src); HoughPoint2Line(weightedPoints[i].second, src, houghLine);
lines.push_back(houghLine); lines.push_back(houghLine);
} }
return true; return true;
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cv { namespace ximgproc { namespace cv { namespace ximgproc {
...@@ -836,23 +835,25 @@ static void crossSegments(Point &point, ...@@ -836,23 +835,25 @@ static void crossSegments(Point &point,
point.y = cvRound(line1.u.y + mul * (line1.v.y - line1.u.y)); point.y = cvRound(line1.u.y + mul * (line1.v.y - line1.u.y));
} }
void HoughPoint2Line(OutputArray line, void HoughPoint2Line(const Point &houghPoint,
const Point &houghPoint, InputArray srcImgInfo,
const Mat &srcImgInfo, Vec4i &line,
int angleRange, int angleRange,
int makeSkew, int makeSkew,
int rules) int rules)
{ {
int const cols = srcImgInfo.cols; Mat srcImgInfoMat = srcImgInfo.getMat();
int const rows = srcImgInfo.rows;
int const cols = srcImgInfoMat.cols;
int const rows = srcImgInfoMat.rows;
CV_Assert(houghPoint.y >= 0); CV_Assert(houghPoint.y >= 0);
CV_Assert(houghPoint.x < cols + rows); CV_Assert(houghPoint.x < cols + rows);
int quad = 0; int quad = 0;
Point rawPoint(0, 0); Point rawPoint(0, 0);
getRawPoint(rawPoint, quad, houghPoint, srcImgInfo, angleRange, makeSkew); getRawPoint(rawPoint, quad, houghPoint, srcImgInfoMat, angleRange, makeSkew);
bool ret = checkRawPoint(rawPoint, quad, srcImgInfo); bool ret = checkRawPoint(rawPoint, quad, srcImgInfoMat);
if (!(rules & RO_IGNORE_BORDERS)) if (!(rules & RO_IGNORE_BORDERS))
{ {
CV_Assert(ret); CV_Assert(ret);
...@@ -906,8 +907,7 @@ void HoughPoint2Line(OutputArray line, ...@@ -906,8 +907,7 @@ void HoughPoint2Line(OutputArray line,
if (!ret) if (!ret)
{ {
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
return; return;
} }
...@@ -933,8 +933,7 @@ void HoughPoint2Line(OutputArray line, ...@@ -933,8 +933,7 @@ void HoughPoint2Line(OutputArray line,
break; break;
} }
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
return; return;
} }
...@@ -1021,8 +1020,7 @@ void HoughPoint2Line(OutputArray line, ...@@ -1021,8 +1020,7 @@ void HoughPoint2Line(OutputArray line,
break; break;
} }
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y); line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
//M*/ //M*/
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cvtest namespace cvtest
{ {
...@@ -288,7 +287,7 @@ int TestFHT::validate_line(Mat const& fht, ...@@ -288,7 +287,7 @@ int TestFHT::validate_line(Mat const& fht,
Point fht_max(-1, -1); Point fht_max(-1, -1);
minMaxLoc(fht_channels[ch], 0, 0, 0, &fht_max); minMaxLoc(fht_channels[ch], 0, 0, 0, &fht_max);
Vec4i src_line; Vec4i src_line;
HoughPoint2Line(src_line, fht_max, src, HoughPoint2Line(fht_max, src, src_line,
ARO_315_135, HDO_DESKEW, RO_STRICT); ARO_315_135, HDO_DESKEW, RO_STRICT);
double const a = src_line[1] - src_line[3]; double const a = src_line[1] - src_line[3];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment