opencv - SiftFeatureDetector()和Ptr

SiftFeatureDetector()和Ptr之间有什么区别?它们显然具有相同的功能。 opencv tutorial使用SiftFeatureDetector,但是当clicking on the official documentation使用Ptr时却没有提及SiftFeatureDetector(),因此我无法阅读。就像在教程中一样,他们使用了这个:int minHessian = 400; SurfFeatureDetector detector( minHessian );,我不知道minHessian应该做什么。

我还在相同的图像上尝试过它们,它们都具有相同的结果,那么为什么它们不同?

int _tmain(int argc, _TCHAR* argv[])
{
//initModule_nonfree();
Mat img;

img = imread("c:\\box.png", 0);

//cvtColor( img, gry, CV_BGR2GRAY );

 //SiftFeatureDetector detector;
//vector<KeyPoint> keypoints;
//detector.detect(img, keypoints);

Ptr<FeatureDetector> feature_detector = FeatureDetector::create("SIFT");
vector<KeyPoint> keypoints;

feature_detector->detect(img, keypoints);

Mat output;

drawKeypoints(img, keypoints, output, Scalar::all(-1));

namedWindow("meh", CV_WINDOW_AUTOSIZE);
imshow("meh", output);
waitKey(0);



return 0;

}

谢谢

最佳答案

编辑:在下面的评论中,通过@ gantzer89进行更正。 (为了清晰起见,保留了原始文本。)

以我的一般经验,使用FeatureDetector::create()语法(在您引用的“官方文档”中讨论了here)可以灵活地在运行时通过参数文件指定算法,而更具体的类(例如SiftFeatureDetector,提供更多定制机会。

create()方法从一组默认的特定于算法的参数开始,而特定于算法的类则允许在构造时自定义这些参数。因此,create()方法为minHessian分配了默认值,而SiftFeatureDetector构造函数提供了选择minHessian值的机会。

根据经验,如果要快速尝试使用哪种算法,请使用create()语法,如果要尝试微调特定算法,请使用特定于算法的类构造函数。

关于opencv - SiftFeatureDetector()和Ptr <FeatureDetector>之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13220707/

相关文章:

macos - 如何在Mac OS X 10.6.8上安装openCV库

xcode - 使用OpenCV仅检测圆

opencv - cvBlobsLib 查找重叠的 blob

opencv - 如何找到检测到的圆的顺序?

visual-studio-2008 - 带有cuda MS Visual Studio 2008的

windows - OpenCV CVShow图像无法获得焦点

c# - 将EMGUCV VectorOfKeyPoint保存到XML并再次加载

visual-c++ - OpenCv 和 Visual C++ Eyedetection

android - OpenCV裁剪功能致命信号11

opencv - OpenCV中的对象跟踪