我在项目中使用OpenCV框架从工作演示中遗漏了一些小问题。
重现的步骤:
使用钛创建一个新的Titainum iOS模块--platform = iphone --type = module --dir =。 --name = opencv --id = opencv
打开XCode项目,从FaceTracker应用程序和其他必需的框架中拖动OpenCV框架。
将OTHER_LDFLAGS = $(继承)-framework OpenCV添加到module.xcconfig
创建名为OpencvView和OpencvViewProxy的新TiUIView和TiUIViewProxy类。
在新的OpencvView类中,实例化一个使用OpenCV的UIViewController。
构建将构建Titanium模块,但是当我尝试运行模块测试工具时,我得到了OpenCV对象的这些错误:
架构i386的未定义符号: " _CMSampleBufferGetImageBuffer",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CMSampleBufferGetOutputPresentationTimeStamp",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CMTimeMake",引自: - libopencv.a中的[VideoCaptureViewController createCaptureSessionForCamera:qualityPreset:grayscale:](VideoCaptureViewController.o) " _CVPixelBufferGetBaseAddress",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferGetBaseAddressOfPlane",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferGetHeight",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferGetPixelFormatType",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferGetWidth",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferLockBaseAddress",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " _CVPixelBufferUnlockBaseAddress",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) " cv :: _ InputArray :: _ InputArray(cv :: Mat const&)",引自: - libopencv.a中的[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:](DemoVideoCaptureViewController.o) " cv :: _ OutputArray :: _ OutputArray(cv :: Mat&)",引自: - libopencv.a中的[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:](DemoVideoCaptureViewController.o) " cv :: CascadeClassifier :: load(std :: string const&)",引自: - libopencv.a中的[DemoVideoCaptureViewController viewDidLoad](DemoVideoCaptureViewController.o) " cv :: CascadeClassifier :: CascadeClassifier()",引自: - libopencv.a中的[DemoVideoCaptureViewController .cxx_construct](DemoVideoCaptureViewController.o) " cv :: CascadeClassifier :: ~CascadeClassifier()",引自: - libopencv.a中的[DemoVideoCaptureViewController .cxx_destruct](DemoVideoCaptureViewController.o) " cv :: Mat :: deallocate()",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) - libopencv.a中的[UIImage(UIImage_OpenCV)CVMat](UIImage + OpenCV.o) - libopencv.a中的[UIImage(UIImage_OpenCV)CVGrayscaleMat](UIImage + OpenCV.o) " cv :: Mat :: create(int,int const *,int)",引自: - libopencv.a中的[UIImage(UIImage_OpenCV)CVMat](UIImage + OpenCV.o) - libopencv.a中的[UIImage(UIImage_OpenCV)CVGrayscaleMat](UIImage + OpenCV.o) " cv :: flip(cv :: _ InputArray const&,cv :: _ OutputArray const&,int)",引自: - libopencv.a中的[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:](DemoVideoCaptureViewController.o) " cv :: resize(cv :: _ InputArray const&,cv :: OutputArray const&,cv :: Size ,double,double,int)",引自: - libopencv.a中的[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:](DemoVideoCaptureViewController.o) " cv :: fastFree(void *)",引自: - libopencv.a中的[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:](VideoCaptureViewController.o) - libopencv.a中的[UIImage(UIImage_OpenCV)CVMat](UIImage + OpenCV.o) - libopencv.a中的[UIImage(UIImage_OpenCV)CVGrayscaleMat](UIImage + OpenCV.o) " cv :: transpose(cv :: _ InputArray const&,cv :: _ OutputArray const&)",引自: - libopencv.a中的[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:](DemoVideoCaptureViewController.o) " _kCVPixelBufferPixelFormatTypeKey",引自: - libopencv.a中的[VideoCaptureViewController createCaptureSessionForCamera:qualityPreset:grayscale:](VideoCaptureViewController.o) ld:找不到架构i386的符号 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
答案 0 :(得分:1)
我有类似的错误。只是改变“构建设置”并没有帮助。
最后,我通过添加coreMedia,coreVideo等框架解决了这个问题。 但是,我的代码中没有使用这些框架。
所以我猜openCV需要这些框架。但我不知道为什么。
希望这会有所帮助:)
答案 1 :(得分:0)
我在Xcode 4.5.1上的默认apple llvm编译器遇到了类似的问题。尝试将其更改为gcc(来自您的构建选项),看看是否有效。