2017-03-31 8 views
1

で失敗することがあります。シンプルIOSコードは、私は、私のプロジェクトにopencv2.frameworkをドラッグし、シミュレータ上で実行するが、私はIOSでのOpenCVを使用してIOSのための初心者と思います実際のデバイス

#import "opencv2/opencv.hpp" 
#import "opencv2/highgui/ios.h" 

#import "ViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    UIImage* a = [UIImage imageNamed:@"jay1.jpg"]; 

    cv::Mat b; 
    UIImageToMat(a, b); 
    cv::cvtColor(b, b, CV_BGR2GRAY); 
    UIImage* c = MatToUIImage(b); 
    self.view.backgroundColor = [UIColor colorWithPatternImage:c]; 

    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Welcome to OpenCV" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil]; 
    [alert show]; 
} 


- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

このコードはSimulatorで正常に実行できます。実際のデバイスで実行している間にエラーが発生しましたが、このエラーメッセージをクリックしても応答は表示されません。

Apple Mach-O Linker (ld) Error: 
error: linker command failed with exit code 1 (use -v to see invocation) 

私のXcode(8.3)とIOS(10.3)デバイスはすべて最新バージョンであり、OpenCVバージョンは2.4.9です。

QuartzCore.framework 
CoreVideo.framework 
CoreMedia.framework 
CoreImage.framework 
AVFoundation.framework 
AssetsLibrary.framework 
Accelerate.framework 
CoreGraphics.framework 
Foundation.framework 
UIKit.framework 
opencv2.framework 

誰がどのように私の実際のデバイス上でこれらのコードを実行する方法を教えてもらえ:私はまた、のようないくつかの必要な枠組みをドラッグしていました。助けてくれてありがとう。

+0

さらに、[opencv](http://opencv.org/releases.html)にOpenCV 3.2.0 IOSパックをダウンロードしました。出来た! –

答えて

0

あなたのopencv2.frameworkはx86とx86-64アーキテクチャのみで構築されているからです。 armv7、armv7s(32ビットiPhone用)、arm64(iphone 6以降用)、またはソースからビルドする(instructionを参照)必要があります。

+0

私はこのメソッドを試して、arm64用にビルドしてプロジェクトにロードします。ありがとうございました。 –

+0

IOS用OpenCVフレームワーク3.2.0は、よくサポートしています。ありがとう! –

関連する問題