OpenCV 3.1 Cuda FAST algorithm

asked 2016-05-14 07:30:13 -0500

Avii gravatar image

Hello, I'd like to use the FAST algorithm on my GPU. The picure is stored in a Mat frame. What I got so far:

cuda::GpuMat gpuImg0;
cuda::GpuMat gpuInput_gray(gpuImg0.size(), gpuImg0.type());
cv::cuda::cvtColor(gpuImg0, gpuInput_gray, COLOR_BGR2GRAY);
cv::Ptr<cv::cuda::FastFeatureDetector> d_fast = cv::cuda::FastFeatureDetector::create(20, 1,cv::FastFeatureDetector::TYPE_9_16);
std::vector<cv::KeyPoint> d_keypoints;
d_fast->detect(gpuInput_gray, gpu_keypoints);

But now I have the keypoints stored in gpu_keypoints. I do not know how to get them back to the CPU or write them in a GpuMat. In OpenCV 2.x i could use the function drawKeypoints, but it's disabled in 3.x. How to do it now?

Greetings :)

Avii

edit retag flag offensive close merge delete

Comments

FastFeatureDetector->detetct gets GpuMat and vector of key points which is std::vector d_keypoints; in your code. These key points are already downloaded from GPU to CPU you can use them directly. If you look at the code you can see that keypoints on the GPU are converted to CPU and what you get is these keypoints stored on CPU. code: https://github.com/Itseez/opencv/blob...

Ender Tunç gravatar imageEnder Tunç ( 2016-05-14 11:11:27 -0500 )edit