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 @@
#include "ximgproc/edge_filter.hpp"
#include "ximgproc/structured_edge_detection.hpp"
#include "ximgproc/seeds.hpp"
#include "ximgproc/fast_hough_transform.hpp"
/** @defgroup ximgproc Extended Image Processing
@{
......
......@@ -130,7 +130,7 @@ typedef enum {
* The function calculates the fast Hough transform for full, half or quarter
* range of angles.
*/
CV_EXPORTS_W void FastHoughTransform( InputArray src,
CV_EXPORTS_W void FastHoughTransform( InputArray src,
OutputArray dst,
int dstMatDepth,
int angleRange = ARO_315_135,
......@@ -139,9 +139,9 @@ CV_EXPORTS_W void FastHoughTransform( InputArray src,
/**
* @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 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
......@@ -152,12 +152,12 @@ 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( OutputArray line,
const Point &houghPoint,
const Mat &srcImgInfo,
int angleRange = ARO_315_135,
int makeSkew = HDO_DESKEW,
int rules = RO_IGNORE_BORDERS );
CV_EXPORTS_W void HoughPoint2Line( const Point &houghPoint,
InputArray srcImgInfo,
Vec4i &line,
int angleRange = ARO_315_135,
int makeSkew = HDO_DESKEW,
int rules = RO_IGNORE_BORDERS );
} }// namespace cv::ximgproc
......
......@@ -42,7 +42,6 @@
//M*/
#include "perf_precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cvtest {
......
......@@ -47,8 +47,6 @@
#include <opencv2/ximgproc.hpp>
#include "fast_hough_transform.hpp"
#include <iostream>
#include <iomanip>
#include <cstdio>
......@@ -197,7 +195,7 @@ bool getLocalExtr(vector<Vec4i> &lines,
for (size_t i = 0; i < weightedPoints.size(); ++i)
{
Vec4i houghLine(0, 0, 0, 0);
HoughPoint2Line(houghLine, weightedPoints[i].second, src);
HoughPoint2Line(weightedPoints[i].second, src, houghLine);
lines.push_back(houghLine);
}
return true;
......
......@@ -42,7 +42,6 @@
//M*/
#include "precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cv { namespace ximgproc {
......@@ -836,23 +835,25 @@ static void crossSegments(Point &point,
point.y = cvRound(line1.u.y + mul * (line1.v.y - line1.u.y));
}
void HoughPoint2Line(OutputArray line,
const Point &houghPoint,
const Mat &srcImgInfo,
int angleRange,
int makeSkew,
int rules)
void HoughPoint2Line(const Point &houghPoint,
InputArray srcImgInfo,
Vec4i &line,
int angleRange,
int makeSkew,
int rules)
{
int const cols = srcImgInfo.cols;
int const rows = srcImgInfo.rows;
Mat srcImgInfoMat = srcImgInfo.getMat();
int const cols = srcImgInfoMat.cols;
int const rows = srcImgInfoMat.rows;
CV_Assert(houghPoint.y >= 0);
CV_Assert(houghPoint.x < cols + rows);
int quad = 0;
Point rawPoint(0, 0);
getRawPoint(rawPoint, quad, houghPoint, srcImgInfo, angleRange, makeSkew);
bool ret = checkRawPoint(rawPoint, quad, srcImgInfo);
getRawPoint(rawPoint, quad, houghPoint, srcImgInfoMat, angleRange, makeSkew);
bool ret = checkRawPoint(rawPoint, quad, srcImgInfoMat);
if (!(rules & RO_IGNORE_BORDERS))
{
CV_Assert(ret);
......@@ -906,8 +907,7 @@ void HoughPoint2Line(OutputArray line,
if (!ret)
{
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
return;
}
......@@ -933,8 +933,7 @@ void HoughPoint2Line(OutputArray line,
break;
}
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
return;
}
......@@ -1021,8 +1020,7 @@ void HoughPoint2Line(OutputArray line,
break;
}
Vec4i pts(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
Mat(pts).copyTo(line);
line = Vec4i(dstLine.v.x, dstLine.v.y, dstLine.u.x, dstLine.u.y);
}
//-----------------------------------------------------------------------------
......
......@@ -42,7 +42,6 @@
//M*/
#include "test_precomp.hpp"
#include "fast_hough_transform.hpp"
namespace cvtest
{
......@@ -288,7 +287,7 @@ 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(src_line, fht_max, src,
HoughPoint2Line(fht_max, src, src_line,
ARO_315_135, HDO_DESKEW, RO_STRICT);
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