VINS-Fusion-gpu icon indicating copy to clipboard operation
VINS-Fusion-gpu copied to clipboard

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

Open lychkovi opened this issue 3 years ago • 0 comments

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!

lychkovi avatar May 04 '21 19:05 lychkovi