OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries, such as Numpuy, python is capable of processing the OpenCV array structure for analysis. To Identify image patterns and its various features we use vector space and perform mathematical operations on these features.
OpenCV is a library used for real-time image processing through a camera. It is used to do various image processing operations like image capturing, applying real-time filters like Snapchat and Instagram, cropping of images and many more.
Applications of OpenCV
There are lots of applications which are solved using OpenCV, some of them are listed below
- face recognition
- Automated inspection and surveillance
- number of people – count (foot traffic in a mall, etc)
- Vehicle counting on highways along with their speeds
- Interactive art installations
- Anamoly (defect) detection in the manufacturing process (the odd defective products)
- Street view image stitching
- Video/image search and retrieval
- Image/video I/O, processing, display (core, imgproc, highgui)
- Object/feature detection (objdetect, features2d, nonfree)
- Geometry-based monocular or stereo computer vision (calib3d, stitching, videostab)
- Computational photography (photo, video, superres)
- Machine learning & clustering (ml, flann)
- CUDA acceleration (gpu)
Steps Required to Add OpenCV library into Android Application
Here are the steps required to perform in the same way to add OpenCV library:
- First of all, go to the official website of OpenCV i.e https://opencv.org/releases/ here you will see various releases with the version name mention above it. You need to download the same version of OpenCV as your android studio version.
- Here download the android package you will see the android package option there as shown in the image below:
- Just click on the android option there and you will be redirected to the page where the download will start automatically.
- After downloading the android package with version same as with your android studio you have to extract the zip folder to your desired location.
- Now open Android Studio and create a new project.
- After creating a new project go to File > New > Import-Module
- Now click on Import-Module as you will see a dialog box like below:
- Now, import the module of OpenCV. So open the location where you extracted the OpenCV library so go to that location. In this case download location was This PC > downloads.
- Then go to SDK
- Then click on java
- Go to the location > OpenCV > SDK >java and done, the android studio will automatically fetch the module from there.
- Click on Next > finish. Now you have to modify the project structure also.
- So go to File > Project Structure > Dependencies in All Dependencies folder click on the + icon then add the module dependency.
- Click on the app and then select the OpenCV dependency and then next then OK.
- Now, some files are needed for the android project.
- So go to app > New > folder > JNI folder
- Then check the Change Folder Location then rename src/main/JNI to src/main/jniLibs then finish.
- Then go to the android studio and the paste all the copied folder into the newly created JNI folder. And all done!
Now OpenCV is added into the android project. If one wants to check that whether it is added successfully he/she can do this by writing the below code into the MainActivity.
Log.d(“Check”,”OpenCv configured successfully”);
Log.d(“Check”,”OpenCv doesn’t configured successfully”);
- How to Add Audio Files to Android App in Android Studio?
- How to add a Pie Chart into an Android Application
- How to Add Local HTML File in Android Studio?
- How to Install Genymotion Emulator and Add it’s Plugin to Android Studio?
- How to Add Different Resolution Images in Android Studio?
- How to Add Image to Drawable Folder in Android Studio?
- Android | How to add Radio Buttons in an Android Application?
- How to install Android Applications in Mobile Phone without USB Cables using Android Studio
- How to add Cutsom Switch using IconSwitch Library in android?
- Android | AdMob Interstitial Ads for Android Studio
- Android | How to Create/Start a New Project in Android Studio?
- How to Clone Android Project from GitHub in Android Studio?
- Android | AdMob Banner Ads for Android Studio
- How to add Slidr Library in Android?
- How to add Toggle Button in an Android Application
- How to Add Widget of an Android Application?
- How to build a simple Calculator app using Android Studio?
- How to create a Stopwatch App using Android Studio
- How to build a simple music player app using Android Studio
- Guessing the Number Game using Android Studio
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.