Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix findContours in SimpleBlobDetector#24433

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
AleksandrPanov wants to merge1 commit intoopencv:4.x
base:4.x
Choose a base branch
Loading
fromAleksandrPanov:update_contour_docs

Conversation

@AleksandrPanov
Copy link
Contributor

@AleksandrPanovAleksandrPanov commentedOct 20, 2023
edited
Loading

commented problem from#24388
TODO: need to fix a bug

Pull Request Readiness Checklist

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

  • I 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 another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the 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

@AleksandrPanovAleksandrPanov marked this pull request as ready for reviewOctober 22, 2023 23:08
minConvexity (inclusive) and maxConvexity (exclusive).
Default values of parameters are tuned to extract dark circular blobs.
@note Don't disable the param filterByArea with dark blobs and white backgound, findContours() find extra contour in this case.
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to extract parameters description from brief section and move to each parameter. It fixes doxygen documentation and add help messages to IDE. Also I propose to rephrase the sentence: "filterByArea should be true for black blobs on white background as findContours expects background to be black and adds extra contours for the case."

The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours
are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the
OpenCV sample directory.
OpenCV sample directory, tutorial @ref tutorial_py_contours_begin} or @ref tutorial_find_contours.
Copy link
Contributor

Choose a reason for hiding this comment

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

extra } in the reference.

Comment on lines +4021 to +4022
@note In OpenCV, finding contours is like finding white object from black background. So remember,
object to be found should be white and background should be black.
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to remove note and extend function description:

Non-zero pixels are treated as 1's. Zeropixels remain 0's, so the image is treated as binary.Zero values (black color) is used as background.

@asmorkalov
Copy link
Contributor

@AleksandrPanov Friendly reminder.

@AleksandrPanovAleksandrPanov marked this pull request as draftNovember 12, 2023 22:29
@AleksandrPanov
Copy link
ContributorAuthor

The contours of a certain size and in a certain position distort the answer. Perhaps this is due to the wrong grouping.
3

result:
(353.14007568359375, 223.4298553466797) 267.6434326171875
problem
We need a fix for this problem.

@AleksandrPanovAleksandrPanov added bug pr: needs testNew functionality requires minimal tests set labelsNov 16, 2023
@AleksandrPanovAleksandrPanov changed the titleupdate docs for findContours/SimpleBlobDetectorfix findContours in SimpleBlobDetectorNov 16, 2023
@AleksandrPanov
Copy link
ContributorAuthor

import cv2 as cvimage = cv.imread("3.png", cv.IMREAD_GRAYSCALE)parameters = cv.SimpleBlobDetector_Params()detector = cv.SimpleBlobDetector_create(parameters)keypoints = detector.detect(image)for kp in keypoints:    print(kp.pt, kp.size)    p = (int(kp.pt[0]), int(kp.pt[1]))    cv.circle(image, p, 5, (255, 255, 255), 2)cv.imshow("1", image)cv.waitKey(0)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asmorkalovasmorkalovasmorkalov left review comments

Assignees

No one assigned

Labels

bugcategory: documentationDocumentation fix or updatecategory: imgprocpr: needs testNew functionality requires minimal tests set

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@AleksandrPanov@asmorkalov

[8]ページ先頭

©2009-2025 Movatter.jp