Reputation: 29
I have tried to implement SIFT with openCV and I have refer to these links link1 and link2. Besides, I have also read the paper about SIFT written by Lowe. I have some problems about the code in link1 and link2.
cv::SiftFeatureDetector detector( 0.05, 5.0 ); cv::SiftDescriptorExtractor extractor( 3.0 );
I can't totally understand the parameter in the above function. If I modify the first function to cv::SiftFeatureDetector detector( 0.05, 10.0 ); , there is a running time OpenCV Error:Assertion failed < firstOctave>=-1 %% actualNLayers<=nOctaveLayers >.
In addition, I don't realize the parameter in the SiftDescriptorExtractor extractor( ). I know there is a distances ratio in keypoints matching, but the range is [0,1].
I want to modify the method which I use to match to picture, so I need to extract the descriptor and the dominant orientation of each keypoint. How do I extract extract each keypoint's descriptor and dominant orientation?
Thank you very much for your reply.
Upvotes: 0
Views: 1850
Reputation: 49
For more info: http://docs.opencv.org/2.3/modules/features2d/doc/common_interfaces_of_descriptor_extractors.html
Upvotes: 1
Reputation: 1469
My advice is that you should use the default parameters of the SIFT at the beginning. Then, if you're not satisfied with the results you can try to refine these parameters.
Ptr<FeatureDetector> detector = new SIFT();;
Ptr<DescriptorExtractor> extractor = new SIFT();
U can find useful information about SIFT parameters in the OpenCV implementation here: http://docs.opencv.org/modules/nonfree/doc/feature_detection.html
To compute the keypoints:
vector<KeyPoint> keypoints;
detector->detect(yourImage, keypoints);
When you compute the keypoints its orientation is automatically calculated and is associated with the parameter 'angle' of each keypoint. Please find more info here: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html
To compute the descriptors of the keypoints:
Mat descriptors;
extractor->compute(yourImage, keypoints, descriptors);
being each row of the Mat descriptors one descriptor.
Please let me know if you have questions! Hope this helps.
Upvotes: 3