2013-06-11 3 views
0

OpenCV 라이브러리를 사용하여 첫 번째 프로그램을 작성하려고합니다. 나는 Xcode 4.6.2를 IDE로 사용하고 있으며 모든 것을 설정하기 위해 이미 많은 튜토리얼을 따라 왔습니다. 내가 C로 (GNU C++ 표준 라이브러리) ++ ++ 표준 라이브러리 된 libstdc 사용하고Xcode에서 아키텍처 x86_64에 대해 정의되지 않은 기호 4.6.2

Undefined symbols for architecture x86_64: 
    "cv::FeatureDetector::~FeatureDetector()", referenced from: 
     cv::Feature2D::~Feature2D() in main.o 
    "cv::DescriptorExtractor::~DescriptorExtractor()", referenced from: 
     cv::Feature2D::~Feature2D() in main.o 
    "cv::SIFT::SIFT(int, int, double, double, double)", referenced from: 
     _main in main.o 
    "cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from: 
     _main in main.o 
    "VTT for cv::SIFT", referenced from: 
     cv::SIFT::~SIFT() in main.o 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

:이

#include <stdio.h> 
#include <iostream> 
#include "opencv2/core/core.hpp" 
#include "opencv2/features2d/features2d.hpp" 
#include "opencv2/highgui/highgui.hpp" 
#include <opencv2/nonfree/nonfree.hpp> 


using namespace cv; 

int main(int argc, const char * argv[]) 
{ 

    String pathToImages="myPathToImages/"; 
    Mat img1=imread(pathToImages+"im1.jpg",CV_LOAD_IMAGE_GRAYSCALE); 
    Mat img2=imread(pathToImages+"im2.jpg",CV_LOAD_IMAGE_GRAYSCALE); 


    if(!img1.data || !img2.data) 
    { std::cout<< " --(!) Error reading images " << std::endl; return -1; } 

    //-- Step 1: Detect the keypoints using SIFT Detector 

    cv::SiftFeatureDetector detector; 


    std::vector<cv::KeyPoint> keypoints_1; 
    std::vector<cv::KeyPoint> keypoints_2; 


    detector.detect(img1, keypoints_1); 
    detector.detect(img2, keypoints_2); 

    //DO SOMENTHING 

    return 0; 
} 

나는 그것을 구축하려고하면 코드

의 내 작은 조각,이 오류가 발생합니다. 누가 잘못되었는지 알아?

+0

을 적용하는 데 사용되는 전체 라이브러리하여 프로젝트? –

+0

예, 죄송합니다. 작성하지 않았습니다. 이 안내서를 먼저 읽었습니다. http://opencv.willowgarage.com/wiki/UsingOpenCVUnderOSX – displayName

+0

OK - 직접 라이브러리를 제작 했습니까? 아니면 미리 만들어진 라이브러리를 사용 했습니까? 라이브러리의 아키텍처를 확인해야합니다.이 작업은'file' 명령으로 수행 할 수 있습니다. 빌드의 아키텍처 (이 경우 x86_64, 즉 i386이 아님)와 일치해야합니다. –

답변

0

나는 도서관을 포함

#include <opencv2/nonfree/features2d.hpp> 

대신 여기

#include "opencv2/features2d/features2d.hpp" 

이다 나는 당신이 관련 OpenCV의 라이브러리를 추가 했 SIFT 검출기

#include <opencv2/core/core.hpp> 
#include <opencv2/highgui/highgui.hpp> 
#include <opencv2/nonfree/features2d.hpp> 
#include <opencv2/nonfree/nonfree.hpp> 
#include <opencv2/opencv.hpp> 
#include <opencv2/imgproc/imgproc.hpp>