My OpenCV4Android road (1) - the beginning

My OpenCV4Android road (1) - the beginning

insert image description here
offer logo

What can OpenCV do?

Computer vision and image processing, don't understand? ID card, face detection, license plate recognition, not interested? Beauty always smells good, right?

Why did you start researching?

Because to put it bluntly, it means insufficient technical reserves, and to put it bluntly, it means lack of self-confidence, self-dissuading, and many excuses.

Let's get started then?

Where to start, android, do this.

How to persist?

content options about what
Technology is not good enough to be looked down upon? A dignity
Being persuaded to retire after 35 years old? B future
Bragging at the girlfriend's present? C love
Wife wants to buy a house in the school district? D Life
Dreaming about programming? E interest

Which one keeps pushing you? what would you choose

learning attitude?

Be neither humble nor overbearing, that's it! ! !

download

environment:

Ubuntu 18.04
opencv-4.5.1-android-sdk.zip

decompress

It contains examples and libraries

├── LICENSE
├── README.android
├── samples
└── sdk

Look at the sdk again

├── build.gradle
├── etc
├── java
├── libcxx_helper
└── native

Confused, there are no guides, only guides, study:

  • etc. I haven't figured it out yet, so I'll add it later.
  • Java, the api module implemented by java code, can be imported as an android module.
  • libxx_helper, there is a blank dumby.cpp in it, the purpose is to let the compiler automatically import libc++_shared.so when packaging, or you can manually import it yourself.
  • Native, various dynamic libraries and static libraries, I will come back to explain in detail later when I figure it out.

The OpenCV core library is implemented in C/C++, and through JNI, it provides APIs for java development partners, which makes our learning curve not so steep.

Import Sample, try something new

insert image description here
It got off to a bad start and became popular:

A problem occurred configuring project ‘:face-detection’.
java.lang.NullPointerException (no error message)

Try again, click Sync

insert image description here

It's still the same, sister! Since gradle failed, experience tells me to change the version of gradle.

before fixing:

distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip

After modification:

distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip

Sure enough, it started syncing. However, again error occurs:

Unable to find method ‘org.gradle.api.file.ProjectLayout.fileProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/RegularFileProperty;’
org.gradle.api.file.ProjectLayout.fileProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/RegularFileProperty;
Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Modify again, find build,.gradle in the root directory, and modify the plug-in version:

before fixing:

classpath ‘com.android.tools.build:gradle:3.2.1’

After modification:

classpath “com.android.tools.build:gradle:4.1.2”

Haha, it worked!

BUILD SUCCESSFUL in 10s

15-puzzle

A digital jigsaw puzzle game. Have you tried Saint Seiya when you were young?
insert image description here

Color Blob Detection

Color detection

insert image description here

face-detection

Face Detection
insert image description here

OCV Image Manipulations

Mosaic, edge detection effect

insert image description here

tutorial-1-camerapreview

Ordinary camera preview, no picture above.

tutorial-2-mixedprocessing

Grayscale, edge detection, etc.
insert image description here

tutorial-3-cameracontrol

Camera size and other parameter adjustments are not shown above.

the end is not the end

So far, we have broken through the first step. After understanding a person's appearance, we will start to understand her inner beauty in the next article.

Guess you like

Origin blog.csdn.net/lucky_tom/article/details/113247850