When using opencv on iOS, you must first install xcode and then download opencv
For IOs: opencv for iOS. Download and decompress it. The following describes the development steps of opencv in IOS.
1) Create an xcode project. Generally, I will create a single view application named helloworld. After the project is created, add opencv2.framework to the project. Click "target", right-click, and select "add files tohelloworld ", in the displayed dialog box, find the opencv2.framework library on your computer, as shown in:
After adding opencv2.framework to the project, modify the pre-compiled header file, that is, the file suffixed with. PCH under the supporting Files folder, and add the following code to the file:
#ifdef __cplusplus #import <opencv2/opencv.hpp>#endif
This code is added to enable the project to set the functions of opencv in the pre-compilation phase. Therefore, it saves the trouble of import when used in its own code. After setting, you can use opencv in Windows and Linux. However, note that when opencv is used, the suffix of the corresponding file must be included. change m. mm, please note that ,. files in mm format support C ++, otherwise an error will be reported.
Suggestion:
1) Many blog posts on the Internet are relatively old. They will all adopt a 2.2.0 version and use cmake for compilation. In the new version, you do not need to compile it yourself. You can download the corresponding IOS framework from the official website.
2) If you have any questions, ask Baidu and Google frequently. People in the Technical Group have many things to deal.