mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
Merge pull request #21030 from tv3141:fix_seg_fault_houghlinespointset
Fix seg fault houghlinespointset * Clarify parameter doc for HoughLinesPointSet * Fix seg fault. * Add regression test. * Fix latex typo
This commit is contained in:
parent
f33828a1ca
commit
cb286a66be
@ -2086,12 +2086,12 @@ The function finds lines in a set of points using a modification of the Hough tr
|
||||
@param point Input vector of points. Each vector must be encoded as a Point vector \f$(x,y)\f$. Type must be CV_32FC2 or CV_32SC2.
|
||||
@param lines Output vector of found lines. Each vector is encoded as a vector<Vec3d> \f$(votes, rho, theta)\f$.
|
||||
The larger the value of 'votes', the higher the reliability of the Hough line.
|
||||
@param lines_max Max count of hough lines.
|
||||
@param lines_max Max count of Hough lines.
|
||||
@param threshold Accumulator threshold parameter. Only those lines are returned that get enough
|
||||
votes ( \f$>\texttt{threshold}\f$ )
|
||||
@param min_rho Minimum Distance value of the accumulator in pixels.
|
||||
@param max_rho Maximum Distance value of the accumulator in pixels.
|
||||
@param rho_step Distance resolution of the accumulator in pixels.
|
||||
votes ( \f$>\texttt{threshold}\f$ ).
|
||||
@param min_rho Minimum value for \f$\rho\f$ for the accumulator (Note: \f$\rho\f$ can be negative. The absolute value \f$|\rho|\f$ is the distance of a line to the origin.).
|
||||
@param max_rho Maximum value for \f$\rho\f$ for the accumulator.
|
||||
@param rho_step Distance resolution of the accumulator.
|
||||
@param min_theta Minimum angle value of the accumulator in radians.
|
||||
@param max_theta Maximum angle value of the accumulator in radians.
|
||||
@param theta_step Angle resolution of the accumulator in radians.
|
||||
|
@ -975,7 +975,9 @@ void HoughLinesPointSet( InputArray _point, OutputArray _lines, int lines_max, i
|
||||
for(int n = 0; n < numangle; n++ )
|
||||
{
|
||||
int r = cvRound( point.at(i).x * tabCos[n] + point.at(i).y * tabSin[n] - irho_min);
|
||||
accum[(n+1) * (numrho+2) + r+1]++;
|
||||
if ( r >= 0 && r <= numrho) {
|
||||
accum[(n+1) * (numrho+2) + r+1]++;
|
||||
}
|
||||
}
|
||||
|
||||
// stage 2. find local maximums
|
||||
|
@ -299,6 +299,36 @@ TEST_P(HoughLinesPointSetTest, regression)
|
||||
run_test();
|
||||
}
|
||||
|
||||
TEST(HoughLinesPointSet, regression_21029)
|
||||
{
|
||||
std::vector<Point2f> points;
|
||||
points.push_back(Point2f(100, 100));
|
||||
points.push_back(Point2f(1000, 1000));
|
||||
points.push_back(Point2f(10000, 10000));
|
||||
points.push_back(Point2f(100000, 100000));
|
||||
|
||||
double rhoMin = 0;
|
||||
double rhoMax = 10;
|
||||
double rhoStep = 0.1;
|
||||
|
||||
double thetaMin = 85 * CV_PI / 180.0;
|
||||
double thetaMax = 95 * CV_PI / 180.0;
|
||||
double thetaStep = 1 * CV_PI / 180.0;
|
||||
|
||||
int lines_max = 5;
|
||||
int threshold = 100;
|
||||
|
||||
Mat lines;
|
||||
|
||||
HoughLinesPointSet(points, lines,
|
||||
lines_max, threshold,
|
||||
rhoMin, rhoMax, rhoStep,
|
||||
thetaMin, thetaMax, thetaStep
|
||||
);
|
||||
|
||||
EXPECT_TRUE(lines.empty());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P( ImgProc, StandartHoughLinesTest, testing::Combine(testing::Values( "shared/pic5.png", "../stitching/a1.png" ),
|
||||
testing::Values( 1, 10 ),
|
||||
testing::Values( 0.05, 0.1 ),
|
||||
|
Loading…
Reference in New Issue
Block a user