Ask Your Question

OzgrCn's profile - activity

2016-04-26 08:24:42 -0600 asked a question Why cuda::ORB detectAndCompute's useProvidedKeypoints parameter is forced to be false?

Hi Everyone,

I would like to use cuda::orb compute or detectAndCompute method to describe keypoints that I detect earlier. But when I try to use these methods I got "Assertion failed (useProvidedKeypoints == false) in detectAndCompute" error. When I search on the source code, I see

void ORB_Impl::detectAndCompute(InputArray _image, InputArray _mask, std::vector<KeyPoint>& keypoints, OutputArray _descriptors, bool useProvidedKeypoints){

CV_Assert( useProvidedKeypoints == false ); 
...

Why does the function takes a useProvidedKeypoints parameter that is forced to be equal to false?

Is there another way to achieve my goal?

Code Sample :

    cv::cuda::GpuMat gpu_img;
    cv::cuda::GpuMat dst;

    cv::Mat img = cv::imread("Lena.pgm", CV_LOAD_IMAGE_GRAYSCALE);
    gpu_img.upload(img);

    cv::Ptr<cv::cuda::ORB> orb = cv::cuda::ORB::create();
    std::vector<cv::KeyPoint> keypoints;
    orb->detect(gpu_img, keypoints); 
     // reason not to use detectAndCompute method only, I detect keypoints earlier and do some calculations to produce new keypoints based on old ones, then I need to describe new ones.   
    orb->compute(gpu_img, keypoints,dst); 
    // same with orb->detectAndCompute(gpu_img, noArray(), keypoints,dst, true);