当前位置:网站首页>Mediapipe gestures (hands)
Mediapipe gestures (hands)
2022-06-26 13:22:00 【Eat bones without spitting out femoral head skin】
List of articles
1、Ubuntu Installation on MediaPipe
2、Ubuntu Build on Android Of MediaPipe
3、Ubuntu Build on MediaPipe Android Archive (AAR)
List of articles
Preface
Recently, there is a need for gesture recognition , So I saw MediaPipe Of Hands, Identify the node coordinates of each gesture , Then simply calculate the gesture .
This article mainly compiles the previous one aar Supplement to the library , Because the official use of our own compilation hands aar library .
One 、 Use steps
1. clone MediaPipe Source code
The order is as follows :
git clone git@github.com:google/mediapipe.git
perhaps
git clone https://github.com/google/mediapipe.git
2.MediaPipe Of Hands Example
open Android studio, Import Android MediaPipe Example
route :mediapipe/mediapipe/examples/android/solutions
,solutions This is Android Of Project, take solutions Import Android studio.
Results after run :
What we need to do next is simple , Is to put build.gradle in Google Maven In the library aar Replace with our own packaging aar.
Will be hands module The following two Maven Library aar Replace with our own packaging aar.
// MediaPipe Hands Solution.
implementation 'com.google.mediapipe:solution-core:latest.release'
implementation 'com.google.mediapipe:hands:latest.release'
structure solution_core.aar
bazel build -c opt --strip=ALWAYS \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--fat_apk_cpu=arm64-v8a,armeabi-v7a \
--legacy_whole_archive=0 \
--features=-legacy_whole_archive \
--copt=-fvisibility=hidden \
--copt=-ffunction-sections \
--copt=-fdata-sections \
--copt=-fstack-protector \
--copt=-Oz \
--copt=-fomit-frame-pointer \
--copt=-DABSL_MIN_LOG_LEVEL=2 \
--linkopt=-Wl,--gc-sections,--strip-all \
--verbose_failures \
//mediapipe/java/com/google/mediapipe/solutioncore:solution_core.aar
structure hands.aar
bazel build -c opt --strip=ALWAYS \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \
--fat_apk_cpu=arm64-v8a,armeabi-v7a \
--legacy_whole_archive=0 \
--features=-legacy_whole_archive \
--copt=-fvisibility=hidden \
--copt=-ffunction-sections \
--copt=-fdata-sections \
--copt=-fstack-protector \
--copt=-Oz \
--copt=-fomit-frame-pointer \
--copt=-DABSL_MIN_LOG_LEVEL=2 \
--linkopt=-Wl,--gc-sections,--strip-all \
--verbose_failures \
//mediapipe/java/com/google/mediapipe/solutions/hands:hands.aar
Will build a successful aar Import hands module Of libs in
take aar Import libs in , And comment out Google Official Maven library , Here's the picture
Next, write the following command to hands module Of build.gradle
// load libs Medium jar and aar
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
// MediaPipe deps
implementation 'com.google.flogger:flogger:latest.release'
implementation 'com.google.flogger:flogger-system-backend:latest.release'
implementation 'com.google.code.findbugs:jsr305:latest.release'
implementation 'com.google.guava:guava:27.0.1-android'
implementation 'com.google.protobuf:protobuf-javalite:3.19.1'
// CameraX core library
def camerax_version = "1.0.0-beta10"
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// AutoValue
def auto_value_version = "1.8.1"
implementation "com.google.auto.value:auto-value-annotations:$auto_value_version"
annotationProcessor "com.google.auto.value:auto-value:$auto_value_version"
To this step , We've done it , Just run it directly , Just put Maven Replace the library with our own aar 了 , In the future, we can compile our own code modifications aar.Google It is also recommended that we compile aar, Because they didn't come up with a unified... That met all their needs aar.
Be careful :
Used at this time CameraX
The version is "1.0.0-beta10", If you update the version to the latest “1.1.0-beta01”, Because the latest version is at least compatible with the current project minsdk There are requirements , The following error occurs .
Execution failed for task ':hands:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.camera:camera-camera2:1.1.0-beta01.
AAR metadata file: C:\Users\LX\.gradle\caches\transforms-3\00310ff015e50555669b323da52d8e97\transformed\camera-camera2-1.1.0-beta01\META-INF\com\android\build\gradle\aar-metadata.properties.
It means the latest CameraX Minimum compiled version (android-31) More than my current Hands module Maximum compiled version of (android-30).
We can build.gradle See our targetSdkVersion and compileSdkVersion be equal to 30
Don't want to solve this problem , Don't update CameraX, ha-ha .
If you are really obsessive-compulsive disorder, you want to update , Then refer to the following solutions .
1、 modify compileSdkVersion and targetSdkVersion by 31
2、 After modification , I will tell you. android 12 Need to explicitly specify Activity Of export attribute
Manifest merger failed : Apps targeting Android 12 and higher are required to specify
an explicit value for `android:exported` when the corresponding component has an intent
filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Reference link : In the log is Google Links to foreign official websites , Unscientific Internet access is impossible , Please refer to android Link to the domestic official website
In the list file ,activity Node visibility assignment for export attribute
Two 、 Reference resources
1、MediaPipe Hands Official document
2、MediaPipe Of GitHub Address
summary
This article is just to MediaPipe Hands Of demo Run up , And will Google Compilation of Maven Library is replaced by its own compiled aar, Because if you have some subsequent changes to your requirements , You can modify the code yourself and regenerate the special aar.
边栏推荐
猜你喜欢
Oplg: new generation cloud native observable best practices
Adapter mode
Beifu PLC realizes data power-off maintenance based on cx5130
Processing polyhedron change
Bifu divides EtherCAT module into multiple synchronization units for operation -- use of sync units
Chapter 01_ Installation and use of MySQL under Linux
解中小企业之困,百度智能云打个样
awk工具
IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times
MySQL数据库讲解(三)
随机推荐
Electron official docs series: References
Electron official docs series: Get Started
E - Apple Catching
Here Document免交互及Expect自动化交互
Explain C language 11 in detail (C language series)
Electron official docs series: Examples
Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
橋接模式(Bridge)
偶言佳句,孤芳自赏
G - Cow Bowling
NVM installation tutorial
Opencv high speed download
Vivado error code [drc pdcn-2721] resolution
Explain C language 10 in detail (C language series)
C - Common Subsequence
MediaPipe手势(Hands)
F - Charm Bracelet
Appearance mode (facade)
A collection of common tools for making we media videos
Decorator