2012-04-19 44 views
6

私はOpenCVのと私のJNIのAndroidアプリケーションをリンクしようとしているが、私は3つのモジュールとリンクしていますこれらのエラーOpenCVの未定義の参照

./obj/local/armeabi 
/libopencv_calib3d.a(calibinit.cpp.o): In function `cvDrawChessboardCorners': 
calibinit.cpp:(.text+0x20a): undefined reference to `cvLine' 
calibinit.cpp:(.text+0x244): undefined reference to `cvLine' 
calibinit.cpp:(.text+0x26e): undefined reference to `cvCircle' 
calibinit.cpp:(.text+0x2ec): undefined reference to `cvLine' 
calibinit.cpp:(.text+0x4ce): undefined reference to `cvLine' 
calibinit.cpp:(.text+0x504): undefined reference to `cvLine' 
calibinit.cpp:(.text+0x532): undefined reference to `cvCircle' 
./obj/local/armeabi/libopencv_calib3d.a(calibinit.cpp.o): In function `cvFindChessboardCorners': 
calibinit.cpp:(.text+0x1b6a): undefined reference to `cvRectangle' 
./obj/local/armeabi/libopencv_calib3d.a(calibinit.cpp.o): In function `cv::findCirclesGrid(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int, cv::Ptr<cv::FeatureDetector> const&)': 
calibinit.cpp:(.text+0x5058): undefined reference to `cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `cv::findCirclesGridDefault(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int)': 
circlesgrid.cpp:(.text+0x2ce): undefined reference to `cv::SimpleBlobDetector::Params::Params()' 
circlesgrid.cpp:(.text+0x2dc): undefined reference to `cv::SimpleBlobDetector::SimpleBlobDetector(cv::SimpleBlobDetector::Params const&)' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `CirclesGridFinder::drawHoles(cv::Mat const&, cv::Mat&) const': 
circlesgrid.cpp:(.text+0xa56): undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
circlesgrid.cpp:(.text+0xafa): undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
circlesgrid.cpp:(.text+0xb44): undefined reference to `cv::circle(cv::Mat&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `CirclesGridFinder::drawBasis(std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > const&, cv::Point_<float>, cv::Mat&) const': 
circlesgrid.cpp:(.text+0x106c): undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `CirclesGridFinder::drawBasisGraphs(std::vector<Graph, std::allocator<Graph> > const&, cv::Mat&, bool, bool) const': 
circlesgrid.cpp:(.text+0x133c): undefined reference to `cv::circle(cv::Mat&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' 
circlesgrid.cpp:(.text+0x13bc): undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `CirclesGridClusterFinder::parsePatternPoints(std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > const&, std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > const&, std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >&)': 
circlesgrid.cpp:(.text+0x3292): undefined reference to `cv::flann::LinearIndexParams::LinearIndexParams()' 
circlesgrid.cpp:(.text+0x32c6): undefined reference to `cv::flann::Index::Index(cv::_InputArray const&, cv::flann::IndexParams const&, cvflann::flann_distance_t)' 
circlesgrid.cpp:(.text+0x346a): undefined reference to `cv::flann::SearchParams::SearchParams(int, float, bool)' 
circlesgrid.cpp:(.text+0x347e): undefined reference to `cv::flann::Index::knnSearch(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::flann::SearchParams const&)' 
circlesgrid.cpp:(.text+0x3484): undefined reference to `cv::flann::IndexParams::~IndexParams()' 
circlesgrid.cpp:(.text+0x3658): undefined reference to `cv::flann::Index::~Index()' 
circlesgrid.cpp:(.text+0x365e): undefined reference to `cv::flann::IndexParams::~IndexParams()' 
circlesgrid.cpp:(.text+0x36b6): undefined reference to `cv::flann::Index::~Index()' 
circlesgrid.cpp:(.text+0x36bc): undefined reference to `cv::flann::IndexParams::~IndexParams()' 
circlesgrid.cpp:(.text+0x3702): undefined reference to `cv::flann::IndexParams::~IndexParams()' 
circlesgrid.cpp:(.text+0x370c): undefined reference to `cv::flann::Index::~Index()' 
./obj/local/armeabi/libopencv_calib3d.a(circlesgrid.cpp.o): In function `CirclesGridFinder::computeRNG(Graph&, std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >&, cv::Mat*) const': 
circlesgrid.cpp:(.text+0x4b2a): undefined reference to `cv::line(cv::Mat&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' 
circlesgrid.cpp:(.text+0x4b7e): undefined reference to `cv::circle(cv::Mat&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' 
circlesgrid.cpp:(.text+0x4bd4): undefined reference to `cv::circle(cv::Mat&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' 
./obj/local/armeabi/libopencv_imgproc.a(contours.cpp.o): In function `cv::drawContours(cv::_OutputArray const&, cv::_InputArray const&, int, cv::Scalar_<double> const&, int, int, cv::_InputArray const&, int, cv::Point_<int>)': 
contours.cpp:(.text+0x3fd2): undefined reference to `cvDrawContours' 
./obj/local/armeabi/libopencv_imgproc.a(samplers.cpp.o): In function `cvSampleLine': 
samplers.cpp:(.text+0x65a2): undefined reference to `cvInitLineIterator' 
./obj/local/armeabi/libopencv_imgproc.a(templmatch.cpp.o): In function `cv::crossCorr(cv::Mat const&, cv::Mat const&, cv::Mat&, cv::Size_<int>, int, cv::Point_<int>, double, int)': 
templmatch.cpp:(.text+0x47e): undefined reference to `cv::getOptimalDFTSize(int)' 
templmatch.cpp:(.text+0x494): undefined reference to `cv::getOptimalDFTSize(int)' 
templmatch.cpp:(.text+0x92c): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)' 
templmatch.cpp:(.text+0xfa4): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)' 
templmatch.cpp:(.text+0x1006): undefined reference to `cv::mulSpectrums(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, bool)' 
templmatch.cpp:(.text+0x102e): undefined reference to `cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)' 
collect2: ld returned 1 exit status 
make: *** [obj/local/armeabi/libarengine.so] Error 1 

を得る:opencv_calib3d opencv_imgproc opencv_core。私は何が欠けていますか?

編集。 私はopencv_flannライブラリを追加し、エラー数を減らしました。しかし、cv :: lineはどこにありますか?例えばcv :: rectangleが定義されていますか?

答えて

17

問題はライブラリの順序であった。正しい順序は次のとおりです。

LOCAL_STATIC_LIBRARIES := libopencv_calib3d opencv_features2d opencv_flann opencv_imgproc opencv_core 

だから、主要な原則はそうでopencv_core *と* opencv_features2d *依存* opencv_imgproc *や*など* opencv_imgproc *が依存(あなたは自分の依存関係とは逆の順序でライブラリを宣言する必要があります)。

2

opencv_highguiとおそらくopencv_features2dもありません。

cv::rectangleは、opencv_coreで定義されています。

ファイルがこれらすべてのライブラリにリンクされていることを確認してください。

1

pkg-config --static --libs opencvの出力を見て、正しい順序でライブラリを配置することもできます。