Ask Your Question

Revision history [back]

You cannot set number of key points but you can try as suggested in doc :

  1. increase contrastThreshold
  2. increase sigma
  3. decrease edge threshold

You cannot set number of key points but you can try as suggested in doc :to reduce keypoint number:

  1. increase contrastThreshold
  2. increase sigma
  3. decrease edge threshold

You cannot set number of key points pointsUse first parameter nfeature of create method

    Mat img=imread("f:/lib/opencv/samples/data/lena.jpg",IMREAD_COLOR);
    for (int i=0;i<5;i++)
    {
        Mat desc;
        vector<KeyPoint> p;
        Ptr<xfeatures2d::SIFT> b= xfeatures2d::SIFT::create(i*100);
        b->detectAndCompute(img,Mat(),p,desc);
        cout<< p.size()<<"\t"<<desc.rows<<"\n";
    }
}

Results :

1111    1111 
100     100 
200     200
300     300 
400     400

but you can try too as suggested in doc to reduce keypoint number:

  1. increase contrastThreshold
  2. increase sigma
  3. decrease edge threshold