TSL_
TSL_

Reputation: 2079

SURF OpenCV - SURF descriptors for pre-defined points

I read OpenCV SURF manual "ExtractSURF" at http://opencv.willowgarage.com/documentation/python/feature_detection.html

as I understand, this function automatically looks for SURF features on the image.

In many cases, the user wants to feed those features (detected by other algorithms) to this function to get the SURF descriptors for these points. But I think the function (ExtractSURF) doesn't support that. Am I right?? it is fixed with SURF features it find out

Is there any resolution for this??

Thanks

Upvotes: 2

Views: 2553

Answers (4)

TSL_
TSL_

Reputation: 2079

From the document of OpenCV, both SIFT and SURF feature detection algorithms support this feature:

 C++: void SURF::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)

 C++: void SIFT::operator()(InputArray img, InputArray mask, vector<KeyPoint>& keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)

The parameter is "useProvidedKeypoints" where

Boolean flag. If it is true, the keypoint detector is not run. Instead, the provided vector of keypoints is used and the algorithm just computes their descriptors."

So, in this case, if you have already got some points you feel interested in, you can feed them into the function and it will return the calculated descriptors for those points accordingly (the keypoint detector is not run in this case)

Upvotes: 0

Truong-An
Truong-An

Reputation: 51

According to manual OPENCV document, function "extractSURF" have format as follows:
cv.ExtractSURF(image, mask, storage, params)-> (keypoints, descriptors)

  • key points: array of key points which contains coordinate of the key point (x,y) and scale, etc..
  • descriptors: SURF descriptor based on coordinate of the key point and the scale on which SURF detect that key point.

    As you can see, extractSURF function is used for computing whole process of SURF from detection to description, so you cannot use your own features for the function to compute SURF descriptors.
    Moreover, the relation between scale of key points in the detection process and scale of constructing regions around key points for extracting the descriptor. It is inappropriate for using other features for SURF descriptor extraction process.
    Thus, in Opencv 3.0, there are only two functions detect and detectAndCompute for SURF right now. It does not allow compute SURF function to be separated.

Upvotes: 0

Neon22
Neon22

Reputation: 630

You want the example that comes with opencv 2.3 called find_obj.py it is in the opencv\samples\python2 samples directory.

It is an excellent example of using SURF in cv2 and python.

Doc on feature detectors is here: http://opencv.itseez.com/modules/features2d/doc/common_interfaces_of_feature_detectors.html#surffeaturedetector

Upvotes: 1

johnlinvc
johnlinvc

Reputation: 314

Yes, but not with OpenCV python API. Using SurfDescriptorExtractor in C++.

Upvotes: 0

Related Questions