CUDA with OpenCV, STL transformation
Hi,
I am writing my own CUDA kernel that should operate on matches I got using BFMatcher_GPU, with knnMatch algorithm in OpenCV. Matches are stored in std::vector<std::vector<cv::DMatch>>
structure.
What would be the easiest and most efficient way to use those matches in my own CUDA kernel? Is the transfer to GpuMat necessary and how would it be done? Could Thrust library be used somehow?
Thanks!
What method do you use : match, knnMatch or radiusMatch? BFMatcher_GPU returns results in GPU memory and have download* methods to convert GPU results into CPU std::vector<cv::DMatch> structure. If you want to use result of BFMatcher_GPU in your CUDA kernel you don't need to download results to CPU, you can use GPU results.
Ok, so here is the code (using knnMatch):
gpu::BFMatcher_GPU matcher(NORM_L2);
matcher.knnMatch( descriptors1GPU,descriptors2GPU, matches1, 2);
Which automatically gives results in std::vector<cv::DMatch>. Should I use knnMatchSingle then or? Does it calculates the results without "downloading" to CPU.