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

Unable to use detected keypoints by FastFeatureDetector to compute with ORB (CUDA version) #9151

Open
jasjuang opened this issue Jul 13, 2017 · 5 comments
Labels

Comments

@jasjuang
Copy link
Contributor

System information (version)
  • OpenCV => Latest
  • Operating System / Platform => Ubuntu 16.04
  • Compiler => GCC 5.4
Detailed description

I am unable to use the detected keypoints found by FastFeatureDetector to compute the descriptors with ORB when using the CUDA API. I was able to do this successfully withe CPU version.

Steps to reproduce
cv::Mat img_cpu = cv::imread("test.png", cv::IMREAD_GRAYSCALE);

cv::cuda::GpuMat img;

img.upload(img_cpu);

cv::Ptr<cv::cuda::ORB> orb =
      cv::cuda::ORB::create(5000, 1.2f, 8, 31, 0, 2, 1, 31, 10, true);

cv::Ptr<cv::cuda::FastFeatureDetector> fast =
      cv::cuda::FastFeatureDetector::create(100, true, 2);

cv::cuda::GpuMat keypointsGPU;
cv::cuda::GpuMat descriptorsGPU;

// this works
orb->detectAsync(img, keypointsGPU);

// but this causes segmentation fault, the same approach works without a problem in cpu 
// fast->detectAsync(img, keypointsGPU);

orb->computeAsync(img, keypointsGPU, descriptorsGPU);
@sovrasov sovrasov added category: features2d category: gpu/cuda (contrib) OpenCV 4.0+: moved to opencv_contrib labels Jul 13, 2017
@mshabunin mshabunin added the bug label Jul 24, 2017
@lukes3315
Copy link

Hey running in this issue too, using opencv 3.4.2. Has this issue been fixed in the newer versions?
Thanks.
Cheers.

@jasjuang
Copy link
Contributor Author

@lukes3315 Unfortunately this problem is still not fixed yet.

@lukes3315
Copy link

lukes3315 commented Nov 13, 2019

Do you guys have some pointers by any chance of where the error stems from?
I've been scanning through the fast.cu/cpp sources, my initial intuition from the behavioral aspect of the bug, is it could be coming from a synchronization issue.
Any help would be greatly appreciated thanks!

@max-kazak
Copy link

max-kazak commented Jun 2, 2021

Does anyone know if this has been fixed in the newer versions?
I get segfault even if I use another ORB detector:

cv::Ptr<cv::cuda::ORB> orb = cv::cuda::ORB::create();
cv::Ptr<cv::cuda::ORB> orb2 = cv::cuda::ORB::create();   
...   
orb->detectAsync(img, keypointsGPU);   
orb2->computeAsync(img, keypointsGPU, descriptorsGPU);   

OpenCV version: 3.4.3

@outoftolerance
Copy link

outoftolerance commented Mar 29, 2024

This issue is still present in OpenCV v4.7.0 and I suspect is unfixed even in more recent versions.

I have been able to perform detectAsync followed by computeAsync on the same keypoints (unlike max-kazak) in his previous post, but have not been able to upload/use keypoints not generated by the ORB detector itself. I believe they aren't being placed into memory correctly, or the computeAsync function isn't calling the correct memory, causing the segfault outcome.

Could anyone point me to the code? I'd like to contribute a fix but have been unable to find the right file.

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

No branches or pull requests

6 participants