dimanche 12 juin 2016

How to use an implemented method from opencv library off the shelf?


Similar to this post and this post, I want to convert detected keypoints to elliptic keypoints by modifying this sample SURF detection and matching code from opencv library.

However, I have little knowledge on c++ syntax and am only familiar with matlab. Previous posts seem to point to using the following code from evaluation.cpp of opencv library to convert them:

void EllipticKeyPoint::convert( const std::vector<KeyPoint>& src, std::vector<EllipticKeyPoint>& dst )
{
    if( !src.empty() )
    {
        dst.resize(src.size());
        for( size_t i = 0; i < src.size(); i++ )
        {
            float rad = src[i].size/2;
            CV_Assert( rad );
            float fac = 1.f/(rad*rad);
            dst[i] = EllipticKeyPoint( src[i].pt, Scalar(fac, 0, fac) );
        }
    }
} 

The Keypoints seem to be generated after line 202 of sample code. So I tried the following to convert them to elliptic keypoints by adding:

  • cv::EllipticKeyPoint::convert(keypoints1, keypoints1); after line 202 and
  • using namespace cv::xfeatures2d::EllipticKeyPoint at the beginning of the code

but both showed errors saying:

  • name followed by '::' must be a class or namespace name and
  • namespace "cv::xfeatures2d" has no member "EllipticKeyPoint" respectively

Which class/namespace/member should I use? How do I write the code properly so that I can use this off the shelf method to convert keypoints to elliptic keypoints?


Aucun commentaire:

Enregistrer un commentaire