First, we need to set up our Android project just like how we did in the previous chapters. We will use the project ID com.masteringopencvandroid.chapter9
. We won't be writing any C++ code for this app as this is not a very computationally intensive task that relies a lot on speed. However, if you require, this project can be done using the native C++ code, as we did in the previous chapters.
First, we will declare the required permissions in our AndroidManifest.xml
file. We will require the camera permission and the permission to save the resulting image to the memory for this project. So, in the manifest tag, add the following lines:
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Now, we will declare the activities that we have in our project. We need only one activity...