iOS6 + Opencv (Latest Compile) Linker Only for classes in Feature2D module

asked 2013-01-18 20:01:52 -0500

hardboy111 gravatar image

updated 2013-01-21 03:27:44 -0500

Hi,

So I managed to successfully compile the latest opencv source and generate the opencv2.framework. I also successfully implemented this tutorial (http://docs.opencv.org/trunk/doc/tutorials/ios/video_processing/video_processing.html).

I then started to modify my code to add in some feature detection code. I included the module #import <opencv2 features2d="" features2d.hpp=""> and started to code including some key classes and methods needed. The intellisense recognised these classes as I started to type e.g.

Algorithm::create<FeatureDetector>
BRISK BRISKD();
BRISKD.create("Feature2D.BRISK");
BRISKD.detect();
BRISKD.compute()

But then when I tried to build I got linker errors for these classes and method calls. Im confused as I know I have the latest version of opencv framework as the video tutorial all worked fine. The specific errors are shown below. Can anyone suggest why I have problems using the Feature2D module on iOS?

    Ld /Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos/Cukamo.app/Cukamo normal armv7
    cd "/Users/mh/Documents/iOS Projects/Business/Cukamo"
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -L/Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos "-L/Users/mh/Documents/iOS Projects/Business/Cukamo/Cukamo/tesseract-ios-lib/lib" "-L/Users/mh/Documents/iOS Projects/Business/Cukamo/Cukamo" -F/Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos "-F/Users/mh/Documents/iOS Projects/Business/Cukamo" "-F/Users/mh/Documents/iOS Projects/Business/Cukamo/../../../../opencv/ios" -filelist /Users/,h/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Intermediates/Cukamo.build/Debug-iphoneos/Cukamo.build/Objects-normal/armv7/Cukamo.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework opencv2 -lc++ -framework CoreMedia -framework CoreVideo -framework CoreGraphics -framework QuartzCore -framework CoreImage -framework AVFoundation -framework AssetsLibrary -framework Accelerate -framework UIKit -framework Foundation -llept -ltesseract_all -o /Users/mh/Library/Developer/Xcode/DerivedData/Cukamo-fzqnynxgvslzftbswmivdfpiuqdy/Build/Products/Debug-iphoneos/Cukamo.app/Cukamo

Undefined symbols for architecture armv7:
  "cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const", referenced from:
      -[ViewController processImage:] in ViewController.o
  "cv::Algorithm::_create(std::string const&)", referenced from:
      cv::Ptr<cv::FeatureDetector> cv::Algorithm::create<cv::FeatureDetector>(std::string const&) in ViewController.o
      cv::Ptr<cv::DescriptorExtractor> cv::Algorithm::create<cv::DescriptorExtractor>(std::string const&) in ViewController.o
  "cv::Feature2D::create(std::string const&)", referenced from:
      -[ViewController processImage:] in ViewController.o
  "cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
      -[ViewController processImage:] in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
edit retag flag offensive close merge delete

Comments

any one? i havent a clue what the problem is - normally linker errors result from a framework not included but it definitely is! :(

hardboy111 gravatar imagehardboy111 ( 2013-01-21 03:33:41 -0500 )edit

Hi. Do you get linker errors related to features2d module only? Does "cv::Mat::eye(3,3, CV_8UC1)" cause linker errors too?

BloodAxe gravatar imageBloodAxe ( 2013-01-23 04:19:12 -0500 )edit

Hi, cv::Mat::eye(3,3, CV_8UC1) did not cause any linker errors - compiled ok.

hardboy111 gravatar imagehardboy111 ( 2013-01-26 08:37:59 -0500 )edit

is this true http://iqwen.net/question/32738 that brisk isnt actually included in the standard opencv build? Could this be a reason why it does not recognise the symbols?

hardboy111 gravatar imagehardboy111 ( 2013-01-26 09:16:11 -0500 )edit

I also invesigated the /features2d/include/opencv2/features2d/features2d.hpp file and found it has a depedency on the module "opencv2/flann/flann.hpp". But when I try and include this in my code it does not exist. Does this mean anything ?

hardboy111 gravatar imagehardboy111 ( 2013-01-26 09:32:31 -0500 )edit

..i also found someone with a similar issue here http://stackoverflow.com/questions/13933513/build-error-using-featured2d-in-opencv-with-xcode but the solution didnt help

hardboy111 gravatar imagehardboy111 ( 2013-01-26 10:53:00 -0500 )edit

Does someone have a ios6 project template sample that uses features2D without linker errors..at this point im willing to make a donation if someone could share it with me :)

hardboy111 gravatar imagehardboy111 ( 2013-01-26 11:00:36 -0500 )edit

In your build settings under Apple LLVM compiler have you tried setting the C++ Standard Library to "LLVM C++ standard library with C++11 support"?

christoph gravatar imagechristoph ( 2013-01-31 03:55:32 -0500 )edit

Did you change your c++ file extension to .mm?

ske gravatar imageske ( 2013-04-11 05:58:09 -0500 )edit

Yes, I am using the c++ file extension .mm, and the same error. exactly the same with http://stackoverflow.com/questions/13933513/build-error-using-featured2d-in-opencv-with-xcode , can not find a solution, can anyone give a help?

Maybe this is the answer? http://answers.opencv.org/question/5237/ios-error-opencv-was-built-without-surf-support/, it is non free

Kevin gravatar imageKevin ( 2013-04-16 04:51:08 -0500 )edit