-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
Fix seg fault houghlinespointset #21030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contribution!
As a bugfix this patch should go into 3.4 branch first.
We will merge changes from 3.4 into 4.x regularly (weekly/bi-weekly).
Please:
- change "base" branch of this PR: 4.x => 3.4 (use "Edit" button near PR title)
- rebase your commits from 4.x onto 3.4 branch. For example:
git rebase -i --onto upstream/3.4 upstream/4.x
(check list of your commits, save and quit (Esc + "wq" + Enter)
whereupstream
is configured by following this GitHub guide and fetched (git fetch upstream
). - push rebased commits into source branch of your fork (with
--force
option)
Note: no needs to re-open PR, apply changes "inplace".
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please to put regression test for this case here: https://github.com/opencv/opencv/blob/3.4.16/modules/imgproc/test/test_houghlines.cpp#L301
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_FALSE(lines.empty());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the test but changed EXPECT_FALSE(lines.empty());
to EXPECT_TRUE(lines.empty());
as no lines will be found.
12ec875
to
150e900
Compare
Thank you for update! Please take a look on doxygen warnings from "Docs" builder: http://pullrequest.opencv.org/buildbot/builders/precommit_docs/builds/32796 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@alalek Thanks for walking me through the process. |
Pull Request Readiness Checklist
Closes #21029
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.