简体   繁体   中英

Opencv Face detection Cascade compiler error in iOS

In my IOS project I have implemented a tesseract sample, in this sample I need to integrate opencv. I have used this sample project , which has default tesseract and opencv.

But I tried implementing face detection with this project, using the below code,

 NSString* cascadePath = [[NSBundle mainBundle]
                             pathForResource:@"haarcascade_frontalface_alt"
                             ofType:@"xml"];
    faceDetector.load( [cascadePath UTF8String] );

But I get the below error:

Undefined symbols for architecture armv7:
  "cv::CascadeClassifier::load(std::string const&)", referenced from:
      -[ViewController viewDidLoad] 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)

Right now in build settings -> C++ compiler -> "default compiler" is selected. I have tries the compiler setting from this link . If I set like this the "Tesseract" code is getting error.

Created faceDetector as below:

@interface ViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate>{
    UIImagePickerController *mediaPicker;
    UIImage *takenImage;
    UIImage *processedImage;
    cv::CascadeClassifier faceDetector;
}

How can I solve this problem?

Delete your existing "opencv2.framework" ( the one that has come up with your xcode project )

Replace it with the official one

NOTE: It does not contain symbols for "armv7s". It would still work on simulator and actual devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM