blob detction opencv249错误

时间:2015-11-25 14:22:15

标签: c++ opencv

我正在运行此代码,我收到错误!

 #include "opencv\opencv.hpp"
    using namespace cv;
    using namespace std; 
    int main( int argc, char** argv ) {
    Mat im = imread( "blob.jpg", CV_LOAD_IMAGE_GRAYSCALE );
    SimpleBlobDetector::Params params;
    params.minThreshold = 10;
    params.maxThreshold = 200;
    params.filterByArea = true;
    params.minArea = 1500;
    params.filterByCircularity = true;
    params.minCircularity = 0.1;
    params.filterByConvexity = true;
    params.minConvexity = 0.87;
    params.filterByInertia = true;
    params.minInertiaRatio = 0.01;
    SimpleBlobDetector detector(params);
    std::vector<KeyPoint> keypoints;
    detector.detect( im, keypoints);
    Mat im_with_keypoints;
    drawKeypoints( im, keypoints, im_with_keypoints, Scalar(0,0,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS );
    imshow("keypoints", im_with_keypoints );
    waitKey(0);
    }

我得到的错误是

1>test.cpp(25): warning C4305: '=' : truncation from 'double' to 'float'
1>test.cpp(29): warning C4305: '=' : truncation from 'double' to 'float'
1>test.cpp(33): warning C4305: '=' : truncation from 'double' to 'float'
1>test.obj : error LNK2001: unresolved external symbol "public: void __thiscall cv::FeatureDetector::detect(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > &,class cv::Mat const &)const " (?detect@FeatureDetector@cv@@QBEXABVMat@2@AAV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@0@Z)
1>test.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall cv::FeatureDetector::~FeatureDetector(void)" (??1FeatureDetector@cv@@UAE@XZ)
1>test.obj : error LNK2001: unresolved external symbol "void __cdecl cv::drawKeypoints(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > const &,class cv::Mat &,class cv::Scalar_<double> const &,int)" (?drawKeypoints@cv@@YAXABVMat@1@ABV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAV21@ABV?$Scalar_@N@1@H@Z)
1>test.obj : error LNK2001: unresolved external symbol "public: __thiscall cv::SimpleBlobDetector::Params::Params(void)" (??0Params@SimpleBlobDetector@cv@@QAE@XZ)
1>test.obj : error LNK2001: unresolved external symbol "public: __thiscall cv::SimpleBlobDetector::SimpleBlobDetector(struct cv::SimpleBlobDetector::Params const &)" (??0SimpleBlobDetector@cv@@QAE@ABUParams@01@@Z)

我检查了物业经理,所有设置好,我正在运行opencv 249和vc 2010 谢谢

1 个答案:

答案 0 :(得分:1)

您遇到的链接问题与代码中的问题无关。 阅读本指南,了解如何正确地将OpenCV与VS.NET链接:http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html