Skip to content

imgproc_fix_houghcircles#20919

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
berak:patch-1
Oct 22, 2021
Merged

imgproc_fix_houghcircles#20919
opencv-pushbot merged 1 commit intoopencv:3.4from
berak:patch-1

Conversation

@berak
Copy link
Copy Markdown
Contributor

@berak berak commented Oct 21, 2021

imgproc: add a check for UMat in HoughCircles

resolves #20913

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • [xI agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Copy link
Copy Markdown
Member

@alalek alalek left a 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!


CV_Assert(!_image.empty() && _image.type() == CV_8UC1 && (_image.isMat() || _image.isUMat()));
CV_Assert(_circles.isMat() || _circles.isVector());
CV_Assert(_circles.isMat() || _circles.isUMat() || _circles.isVector());
Copy link
Copy Markdown
Member

@alalek alalek Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, we don't really need this check at all (whole CV_Assert statement). It is source of similar problems in the future.

.copyTo(_circles) (line 1710) says if container is not supported.

Copy link
Copy Markdown
Contributor Author

@berak berak Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, we don't really need this check at all. It is source of similar problems in the future.

i've no problem closing this
(indeed, it might be better to keep it as is, than to make it look like it is doing anything useful with UMat)

.copyTo(_circles) (line 1710) says if container is not supported.

hmm, i dont run into any issue using master branch (why would coying a Mat to UMat be a problem ?)

ex. code
    Mat img = imread("img/battery_t2.jpg", 0);
    UMat ui; img.copyTo(ui);
    UMat circles;
    HoughCircles(ui, circles, HOUGH_GRADIENT, 1.2, 1500);
    Mat c = circles.getMat(ACCESS_READ);
    cout << c << endl;
[141, 147, 100.44]

Copy link
Copy Markdown
Member

@alalek alalek Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to close, just remove this CV_Assert line (we don't need to duplicate checks, it tries to bring checks from .copyTo, but current attempt is not complete and would be broken in the future again).


i dont run into any issue

as expected.

imgproc: remove asserts for circles_ in HoughCircles
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@opencv-pushbot opencv-pushbot merged commit aa11cc1 into opencv:3.4 Oct 22, 2021
@berak berak deleted the patch-1 branch October 22, 2021 14:25
@alalek alalek mentioned this pull request Oct 23, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error in HoughCircles when using UMat image input

3 participants