Skip to content
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

Non uniform feature detection on low-contrast frame with local high-contrast areas #25

Open
lychkovi opened this issue May 4, 2021 · 0 comments

Comments

@lychkovi
Copy link

lychkovi commented May 4, 2021

I have discovered, that VINS-Fusion-gpu detects less feature points in frames with local high contrast areas. Few feature points are detected in such areas, while the rest of the frame lacks feature points (see the attachment GfttCudaOriginal). After disabling GPU in config file the feature points are detected with a uniform distribution over the whole frame (see the attachment GfttCudaFixed).
After digging into problem I found out that function cv::goodFeaturesToTrack() considers the input mask region to compute threshold value for the eigenvalues of the corners to be detected. This mask excludes circle regions around the features which are currently being tracked thus allowing threshold to be computed over the rest low-contrast areas. However the GPU-accelerated equivalent function cv::cuda::GoodFeaturesToTrackDetector::detect() does not take the input mask into account when it computes the eigenvalue threshold.
This issue can be easily fixed by adding the fourth parameter mask to the function cuda::minMax() call inside the function cv::cuda::GoodFeaturesToTrackDetector::detect().
In current release of OpenCV 3.4.14 one should modify line 111 of the source file https://github.com/opencv/opencv/blob/3.4.14/modules/cudaimgproc/src/gftt.cpp:
cuda::minMax(eig_, 0, &maxVal);
in the following way:
cuda::minMax(eig_, 0, &maxVal, _mask);
You should initiate a pull request to the OpenCV repository.
Thank you for your work. You have developed an awesome piece of software!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant