@prev_tutorial{tutorial_ios_install} @next_tutorial{tutorial_image_manipulation}
| | | | -: | :- | | Original author | Charu Hans | | Compatibility | OpenCV >= 3.0 |
In this tutorial we will learn how to:
Follow this step by step guide to link OpenCV to iOS.
-# Create a new XCode project. -# Now we need to link opencv2.framework with Xcode. Select the project Navigator in the left
hand panel and click on project name.
-# Under the TARGETS click on Build Phases. Expand Link Binary With Libraries option. -# Click on Add others and go to directory where opencv2.framework is located and click open -# Now you can start writing your application.
Now we will learn how to write a simple Hello World Application in Xcode using OpenCV.
Open the file named NameOfProject-Prefix.pch ( replace NameOfProject with name of your
project) and add the following lines of code.
@code{.m}
#ifdef __cplusplus
#import
#endif
@endcode
Add the following lines of code to viewDidLoad method in ViewController.m.
@code{.m}
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Welcome to OpenCV" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
[alert show];
@endcode
You are good to run the project.
With the newer XCode and iOS versions you need to watch out for some specific details