This is my first blog, blogging is not to say that I have a strong technical ability, or to show off their progress. In this era of data and information explosion, everyone will certainly accept a lot of new things, but not everything you can remember clearly, blogging on the one hand is to consolidate and deepen their learning, on the other hand, has been on the various blogs to learn their ideas and methods, they also want to join the group inside, Provide some help to others.
To get to the next, recently received a face recognition mobile platform to build the task, the general task is: the image processing process is all used in C + + processing, and then the results of the processing is transmitted by JNI to the mobile phone side shows the results of processing.
On the internet about according to their own ideas to search the solution, OpenCV has an Android version, can lead into eclipse and as inside, for mobile phone-side image processing recognition, perfect meet the project requirements.
Opencv-androd: https://opencv.org/releases.html after downloading to a directory that does not contain Chinese
In the installation above, there are about two kinds of ideas:
1) Manually configure JNI, configure the Mk file
2) Add with the latest C + + option in the As box
(PS: There are two kinds of ideas, the benevolent see of the beholder, If JNI is very clear, you can download the latest version of the as inside the C + + option, eliminating a lot of tedious steps; If you are not familiar with JNI, you can manually configure the JNI first to deepen your understanding of the knowledge.
This article mainly takes the second method mainly, the first method has a lot of online, can refer to their blog This is my download version number: Android studio version for 3.1.2 opencv-android for 3.4.1
Step1:
Step2:
Then all the way next until Step3:
After the successful creation, you can look under the app has a CPP and Java folder, directly run can see, "Hello World from C + +" to prove that the environment you started to create the right, if there is an error in the middle, the hint is missing XXX plug-ins and the like, Follow the instructions in log to download the installation.
Then click on File Setting "Android SDK" SDK tools with missing click to download.
After we add Opencv341 to our Android Studio, click File "New" import modul Select the downloaded opencv-android Java folder
After do not make any changes always next, after success will see added another folder openCVLibrary341, prove added successfully
Then click on File Project Structure, click
Add Click Finish.
You can then import OpenCV into the mainactivity.
At this point, will (modul:opencvlibrary341) compilesdkversion minsdkversion targetsdkversion All change Sing Woo (Modul:app) under the consistency, click on the upper right of the formula bar Party's
Switch to Project Options
Under the App/src/main folder, create a directory where jnilibs will download all of the content under the OPENCV-ANDROID-SDK under Opencv-android-sdk\sdk\native\libs, and copy it into that directory.
Add the following code to the Androidmanifest.xml file
<uses-permission android:name= "Android.permission.CAMERA"/>
<uses-feature android:name= "Android.hardware.camera" android:required= "false"/>
<uses-feature android:name= "Android.hardware.camera.autofocus" android:required= "false"/>
<uses-feature android:name= "Android.hardware.camera.front" android:required= "false"/>
<uses-feature android:name= "Android.hardware.camera.front.autofocus" android:required= "false"/>
<supports-screens android:resizeable= "true"
Android:smallscreens= "true"
Android:normalscreens= "true"
Android:largescreens= "true"
Android:anydensity= "true"/>
Click the CMake file under the app to modify the contents of the CMake file as follows
Set (Pathopencv d:/software/opencv-android-sdk) set (Pathproject d:/codezoom/useopencvwit Hcmake) Be sure to install your own files as the main
Click on "Build" to see what's wrong with the configuration, (I think it's important to check the two point 1 after the error.) Copy the directory under Win10 to change \/otherwise cannot find the file 2. Check the table of contents correctly)
When we click on the file under CPP, we find that we can add OpenCV's header file.
!!!!!!!!!!!!!
Reference blog: http://webnautes.tistory.com/1054 (may require FQ)
Opencv-android Installation and use