TheJadav

How to add opencv in android studio

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library

OpenCV

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.

Why OpenCV

OpenCV have too many use cases, like image processing, face recognition, and other too. But I am using it here for image processing.

Add OpenCV library

OpenCV library can not be imported with build.gradle implementation url. The are providing source code or module project to us, which we need to add in our application.

I have tried regular method to import it like File -> New -> Import Module, but It is not showing Next or Finish button. Before we go further, if you have not downloaded module file then please visit https://opencv.org/releases/  and download it for android.

You will get zip file, extract it and navigate copy sdk folder in your projects root directory.

Make it module

To make sdk folder as module, we need to modify settings.gradle file. Append below line in file and wait for sync

include ':app' , ':opencv'

Now we can see sdk folder as module folder. So we can add module dependency to our app module and use openCV in our module.

To add module dependency we can right-click on project name -> Open Module Settings -> Dependencies

Share this content:

Share:

More Posts

Introduction to Kotlin: A Versatile and Modern Programming Language

Kotlin, a versatile and modern programming language, offers developers a concise, safe, and interoperable coding experience. With features like null safety, extension functions, and coroutines, Kotlin enhances productivity and readability, making it an attractive choice for Android development and beyond. Whether you’re new to programming or an experienced developer, exploring Kotlin opens up a world of possibilities for building robust and expressive applications.

Mastering the Android Activity Lifecycle: A Comprehensive Guide

The Android Activity Lifecycle is a fundamental concept for Android developers. It defines how an Activity behaves during its lifecycle, from creation to destruction. Understanding the Activity Lifecycle is crucial for managing resources efficiently and delivering a smooth user experience. In this blog post, we’ll briefly introduce the different states an Activity can be in and the main callback methods associated with each state. Let’s dive in and explore this important aspect of Android app development!

Table of Contents

Send Us A Message