我認爲,在OpenCV的最相似的功能是:
goodFeaturesToTrack
下面是代碼:
#pragma once
#include <string>
#include <iostream>
#include <vector>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
//----------------------------------------------------------
// MAIN
//----------------------------------------------------------
int main(int argc, char* argv[])
{
// src image
Mat src;
// dst image
Mat dst;
// Image loading
namedWindow("result");
namedWindow("src");
src=imread("d:\\ImagesForTest\\lena.jpg",0);
cv::cvtColor(src,dst,cv::COLOR_GRAY2BGR);
Mat corners;
cv::goodFeaturesToTrack(src,corners,50,0.01,20.0);
for(int i=0;i<corners.rows;++i)
{
circle(dst,cv::Point(corners.at<float>(i,0),corners.at<float>(i,1)),3,Scalar(255,0,0),-1,CV_AA);
}
imshow("src",src);
imshow("result",dst);
//----------------------------------------------------------
// Wait key press
//----------------------------------------------------------
waitKey(0);
destroyAllWindows();
return 0;
}
而結果:
我看到你正在使用'的#pragma once'。我有問題與使用'雜注'的東西,我在這裏提到我的問題http://stackoverflow.com/questions/21710791/how-to-set-openmp-for-multithreading-in-ubuntu-12-04-for -an-opencv-project?noredirect = 1#comment32828461_21710791 – skm
您可以安全地評論/刪除它。 –
no no ...我不是問你的這篇文章...我有另一個項目,我想使用「雜注」,但我面臨一些問題......所以你可以幫助我... ...我在這裏發佈了我的問題http://stackoverflow.com/questions/21710791/how-to-set-openmp-for-multithreading-in-ubuntu-12-04-for-an-opencv-project/21712492?noredirect= 1#21712492 – skm