Skip to content

Fix Single ThresholdBug in Simple Blob Detector#19859

Merged
alalek merged 3 commits intoopencv:3.4from
danielenricocahall:fix-blob-detector-single-thresh
Apr 8, 2021
Merged

Fix Single ThresholdBug in Simple Blob Detector#19859
alalek merged 3 commits intoopencv:3.4from
danielenricocahall:fix-blob-detector-single-thresh

Conversation

@danielenricocahall
Copy link
Copy Markdown
Contributor

Per the bug mentioned in #6667, if there is only one threshold, the logic which uses minDistBetweenBlobs is not reached. This PR addresses that issue by ensuring that, if there is only one threshold, we add curCenters before the blob distance checking logic. The test replicates the test setup described in the issue, which originally failed but now passes, as centers is now populated and therefore we extract keypoints.

Pull Request Readiness Checklist

See details at https://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 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

@danielenricocahall danielenricocahall force-pushed the fix-blob-detector-single-thresh branch from 5defa8d to 8762110 Compare April 5, 2021 23:29
cast type in comparison and remove docs

address bug with using min dist between blobs in blob detector

use scalar instead of int

address bug with using min dist between blobs in blob detector
@danielenricocahall danielenricocahall force-pushed the fix-blob-detector-single-thresh branch from 8e6822e to d5f6495 Compare April 6, 2021 09:18
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!

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 👍

@alalek alalek merged commit 7686093 into opencv:3.4 Apr 8, 2021
This was referenced Apr 8, 2021
danielenricocahall added a commit to danielenricocahall/opencv that referenced this pull request May 27, 2021
…ctor-single-thresh

Fix Single ThresholdBug in Simple Blob Detector

* address bug with using min dist between blobs in blob detector

cast type in comparison and remove docs

address bug with using min dist between blobs in blob detector

use scalar instead of int

address bug with using min dist between blobs in blob detector

* fix namespace and formatting
@sergiud sergiud mentioned this pull request Sep 4, 2021
4 tasks
// if the difference between min and max threshold is less than the threshold step
// we're only going to enter the loop once, so we need to add curCenters
// to ensure we still use minDistBetweenBlobs
centers.push_back(curCenters);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change is considered as invalid.
It produces invalid keypoint with mean point of centers (code)

relates #20649

SimpleBlobDetector::Params params;
params.minThreshold = 250;
params.maxThreshold = 260;
std::vector<KeyPoint> keypoints;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

params.minRepeatability = 2 by default.
This is why no keypoints are detected here if there is one "threshold" only (which parameters combination doesn't makes sense).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants