Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Surf feature error in code

I am doing code for feature extraction using SURF , but it give me error in it here below is my program

#include <iostream>
#include <sys/stat.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include  <vector>
#pragma comment (lib , "opencv_core244d.lib")
#pragma comment (lib ,"opencv_highgui244d.lib")
#pragma comment(lib , "opencv_imgproc244d.lib")
#pragma comment(lib ,"opencv_video244.lib")
using namespace cv ;

int main(int argc, char *argv[])
{
    Mat image1, outImg1, image2, outImg2;


    vector<KeyPoint> keypoints1, keypoints2;


    image1 = imread("1.jpg",0);
    image2 = imread("2.jpg",0);

    SurfFeatureDetector surf(2500);
    surf.detect(image1, keypoints1);
    surf.detect(image2, keypoints2);
    drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

    namedWindow("SURF detector img1");
    imshow("SURF detector img1", outImg1);

    namedWindow("SURF detector img2");
    imshow("SURF detector img2", outImg2);

    SurfDescriptorExtractor surfDesc;
    Mat descriptors1, descriptors2;
    surfDesc.compute(image1, keypoints1, descriptors1);
    surfDesc.compute(image2, keypoints2, descriptors2);

    cv::waitKey();
    return 0;
}

These are the error's

Error2  error LNK2019: unresolved external symbol "public: void __thiscall cv::DescriptorExtractor::compute(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > &,class cv::Mat &)const " (?compute@DescriptorExtractor@cv@@QBEXABVMat@2@AAV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAV32@@Z) referenced in function _main
Error3  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(void)" (??0SURF@cv@@QAE@XZ) referenced in function _main
Error4  error LNK2019: 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) referenced in function _main
Error5  error LNK2019: 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) referenced in function _main   
Error6  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(double,int,int,bool,bool)" (??0SURF@cv@@QAE@NHH_N0@Z) referenced in function _main
Error7  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::FeatureDetector::~FeatureDetector(void)" (??1FeatureDetector@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error8  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::DescriptorExtractor::~DescriptorExtractor(void)" (??1DescriptorExtractor@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error9  error LNK1120: 7 unresolved externals

It didn't show me the error when i write code in VS2010 , but it show me error when i debug it , and can i use the same code for video , i use the following steps but can not solve it

link of step followed

Surf feature error in code

I am doing code for feature extraction using SURF , but it give me error in it here below is my program

#include <iostream>
#include <sys/stat.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include  <vector>
#pragma comment (lib , "opencv_core244d.lib")
#pragma comment (lib ,"opencv_highgui244d.lib")
#pragma comment(lib , "opencv_imgproc244d.lib")
#pragma comment(lib ,"opencv_video244.lib")
"opencv_imgproc244d.lib") 
#pragma comment(lib ,"opencv_video244d.lib")
#pragma comment(lib ,"opencv_features2d244d.lib")
#pragma comment(lib ,"opencv_nonfree244d.lib")
using namespace cv ;
;   
int main(int argc, char *argv[])
{
    initModule_nonfree();
    Mat image1, outImg1, image2, outImg2;


    vector<KeyPoint> keypoints1, keypoints2;


    image1 = imread("1.jpg",0);
    image2 = imread("2.jpg",0);

    SurfFeatureDetector surf(2500);
    surf.detect(image1, keypoints1);
    surf.detect(image2, keypoints2);
    drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

    namedWindow("SURF detector img1");
    imshow("SURF detector img1", outImg1);

    namedWindow("SURF detector img2");
    imshow("SURF detector img2", outImg2);

    SurfDescriptorExtractor surfDesc;
    Mat descriptors1, descriptors2;
    surfDesc.compute(image1, keypoints1, descriptors1);
    surfDesc.compute(image2, keypoints2, descriptors2);

    cv::waitKey();
    return 0;
}

These are the error'simage description

Error2  error LNK2019: unresolved external symbol "public: void __thiscall cv::DescriptorExtractor::compute(class cv::Mat const &,class std::vector<class cv::KeyPoint,class std::allocator<class cv::KeyPoint> > &,class cv::Mat &)const " (?compute@DescriptorExtractor@cv@@QBEXABVMat@2@AAV?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAV32@@Z) referenced in function _main
Error3  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(void)" (??0SURF@cv@@QAE@XZ) referenced in function _main
Error4  error LNK2019: 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) referenced in function _main
Error5  error LNK2019: 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) referenced in function _main   
Error6  error LNK2019: unresolved external symbol "public: __thiscall cv::SURF::SURF(double,int,int,bool,bool)" (??0SURF@cv@@QAE@NHH_N0@Z) referenced in function _main
Error7  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::FeatureDetector::~FeatureDetector(void)" (??1FeatureDetector@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error8  error LNK2019: unresolved external symbol "public: virtual __thiscall cv::DescriptorExtractor::~DescriptorExtractor(void)" (??1DescriptorExtractor@cv@@UAE@XZ) referenced in function "public: virtual __thiscall cv::Feature2D::~Feature2D(void)" (??1Feature2D@cv@@UAE@XZ)
Error9  error LNK1120: 7 unresolved externals

It didn't show me the error when i write code in VS2010 , but it show me error when i debug it , and can i use the same code for video , i use the following steps but can not solve it

link of step followed

Surf feature error in codeRun-time error

I am doing code for feature extraction using SURF , but it give me error in it here below is my program

#include <iostream>
#include <sys/stat.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include  <vector>
#pragma comment (lib , "opencv_core244d.lib")
#pragma comment (lib ,"opencv_highgui244d.lib")
#pragma comment(lib , "opencv_imgproc244d.lib") 
#pragma comment(lib ,"opencv_video244d.lib")
#pragma comment(lib ,"opencv_features2d244d.lib")
#pragma comment(lib ,"opencv_nonfree244d.lib")
using namespace cv ;   
int main(int argc, char *argv[])
{
    initModule_nonfree();
    Mat image1, outImg1, image2, outImg2;


    vector<KeyPoint> keypoints1, keypoints2;


    image1 = imread("1.jpg",0);
    image2 = imread("2.jpg",0);

    SurfFeatureDetector surf(2500);
    surf.detect(image1, keypoints1);
    surf.detect(image2, keypoints2);
    drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

    namedWindow("SURF detector img1");
    imshow("SURF detector img1", outImg1);

    namedWindow("SURF detector img2");
    imshow("SURF detector img2", outImg2);

    SurfDescriptorExtractor surfDesc;
    Mat descriptors1, descriptors2;
    surfDesc.compute(image1, keypoints1, descriptors1);
    surfDesc.compute(image2, keypoints2, descriptors2);

    cv::waitKey();
    return 0;
}

image description

Surf feature Run-time error

I am doing code for feature extraction using SURF , but it give me run-time error in it , i don't think so it's error in program but here below is my programit is

#include <iostream>
#include <sys/stat.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <opencv/cv.h>
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include  <vector>
#pragma comment (lib , "opencv_core244d.lib")
#pragma comment (lib ,"opencv_highgui244d.lib")
#pragma comment(lib , "opencv_imgproc244d.lib") 
#pragma comment(lib ,"opencv_video244d.lib")
#pragma comment(lib ,"opencv_features2d244d.lib")
#pragma comment(lib ,"opencv_nonfree244d.lib")
using namespace cv ;   ;


int main(int argc, char *argv[])
{
    initModule_nonfree();
    Mat image1, outImg1, image2, outImg2;


    vector<KeyPoint> keypoints1, keypoints2;


    image1 = imread("1.jpg",0);
    image2 = imread("2.jpg",0);

    SurfFeatureDetector surf(2500);
    surf.detect(image1, keypoints1);
    surf.detect(image2, keypoints2);
    drawKeypoints(image1, keypoints1, outImg1, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
    drawKeypoints(image2, keypoints2, outImg2, Scalar(255,255,255), DrawMatchesFlags::DRAW_RICH_KEYPOINTS);

    namedWindow("SURF detector img1");
    imshow("SURF detector img1", outImg1);

    namedWindow("SURF detector img2");
    imshow("SURF detector img2", outImg2);

    SurfDescriptorExtractor surfDesc;
    Mat descriptors1, descriptors2;
    surfDesc.compute(image1, keypoints1, descriptors1);
    surfDesc.compute(image2, keypoints2, descriptors2);

    cv::waitKey();
    return 0;
}

Error: It give me the option of Continue or Break and also the following Dos screen appears image description