Giter Club home page Giter Club logo

googlemediapipepackagedll's Introduction

GoogleMediapipePackageDll

This example is based on Mediapipe v0.8.6, the specific version is shown in the following figure:

mediapipeversion

At present, some people report that using the latest version of Mediapipe, the code can be compiled successfully but not run successfully.

Haven't had time to try the latest version of Mediapipe yet, but if you compile with the latest version, you should use the latest version of the model instead of the model in my repository.

HandTracking Example

HandTracking

HolisticTracking Example

HolisticTracking

中文文档

1 Project Introduction

The HandTracking and HolisticTracking functions in Google Mediapipe are encapsulated into a dynamic link library, in which dll/hand_tracking_test corresponds to the encapsulation of the HandTracking function, and dll/holistic_tracking_dll corresponds to the encapsulation of the HolisticTracking function.

2 Project Structure

  • The dll folder contains header files, source files, and Bazel compiled project files for generating dynamic link libraries;
  • dll_use_example contains a Visual Studio 2019 project, mainly to demonstrate how to use the above compiled dynamic link library;

3 Configuration Tutorial

3.1 Compilation tutorial of Mediapipe C++ on Windows

3.2 A tutorial for encapsulating Mediapipe HandTracking as a dll

3.3 A tutorial for encapsulating Mediapipe HolisticTracking as a dll

googlemediapipepackagedll's People

Contributors

hw140701 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

googlemediapipepackagedll's Issues

opencv 声明的变量经常会报错,未声明的变量, 以及图像送入mediapipe 推理错误

// 获取当前距离1970的微秒时间
// size_t frame_timestamp_us =
//  	(double)cv::getTickCount() / (double)cv::getTickFrequency() * 1e6;

std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> tpMicro
    = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now());
size_t frame_timestamp_us = tpMicro.time_since_epoch().count();

作者本来用的是我注释掉的,但是我编译的时候就会报错,未声明变量

我用作者注释掉的代码作为时间戳,图片信息一直不能送进去, 图片的宽高这个信息我已经调整了。
MP_RETURN_IF_ERROR(m_Graph.AddPacketToInputStream(
m_Video_InputStreamName, mediapipe::Adopt(input_frame.release()).At(mediapipe::Timestamp(frame_timestamp_us))));
再次打扰,多谢了

关于mediapipe hand landmark detect c++

您好,非常感谢您的工作。
请问一下如果想要将手部关键点检测单独封装,可以大致怎么修改呢?
期待您的回复。
祝您工作顺利!

win10 fetching @local_execution_config_platform permission denied

大佬,您好,我在编译的时候出现了权限问题请问是什么原因呀,管理员打开cmd也是如此,看着像远程仓库的问题,但是换了好多个版本都不行,bazel和mediapipe都是官方推荐对应的版本。头疼至极,最近急需解决,还望大佬指点一二!
image

handtracking 封装编译失败

你好,我在[将Mediapipe handtracking封装成动态链接库dll/so](Mediapipe - 将Mediapipe handtracking封装成动态链接库dll/so,实现在桌面应用中嵌入手势识别功能 - StubbornHuang Blog)按步骤进行动态链接库编译时遇到了以下问题,网络上没有查到有用的解决方法,希望能不吝赐教。

环境:

  • Windows10
  • VS2019
  • mediapipe v0.9.1
  • bazel bazel-7.0.0-pre.20230209.2

问题描述:

image-20230224225137954

image-20230224224721364

image-20230224224744315

使用命令bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="D:\\Anaconda3\\envs\\tensorflow\\python.exe" mediapipe/examples/desktop/hand_tracking_test:Mediapipe_Hand_Tracking --verbose_failures编译动态链接库,mediapipe目录下examples\desktop\hand_tracking_test文件夹内有hand_gesture_recognition.cpp、hand_gesture_recognition.h、hand_tracking_api.cpp、hand_tracking_api.h、hand_tracking_data.h、hand_tracking_detect.cpp、hand_tracking_detect.h以及BUILD文件。

BUILD文件部分如下:

image-20230224230111288

另外,在此环境下helloWorld可以成功编译。

关于项目的Windows Arm64版本的编译

感觉这个项目可以继续发展,然后像opencvsharp那样封装成c#版本的,结合ml.net可以为.net生态代码机器视觉相关的开箱即用的功能了。

编译失败

作者您好,我按照的您的编译过程出现了这个报错,我的版本和您都保持一致的

image

在absl/flags資料夾中找不到flag.h和parse.h

您好,
我剛剛按照您的教學,
完成編譯並成功運行hello_world.exe
但要開始撰寫c++的code時,
在#include"absl/flags.flag.h"和
#include "absl/flags/parse.h"這兩列給出錯誤,
後來發現flags資料夾中沒有flag.h和parse.h這兩個檔案(我的python有安裝tensorflow)
請問這種現象是什麼地方發生問題呢?

作者您好,我试了官方hello world 以及 pose tracking都可以编译,但holistic_tracking_dll出现以下报错,搜了很久一直没解决,能麻烦帮忙看下不,谢谢!

image

Compiling mediapipe/examples/desktop/holistic_tracking_dll/HolisticTrackingApi.cpp failed: undeclared inclusion(s) in rule '//mediapipe/examples/desktop/holistic_tracking_dll:MediapipeHolisticTracking': this rule is missing dependency declarations for the following files included by 'mediapipe/examples/desktop/holistic_tracking_dll/HolisticTrackingApi.cpp': 'external/com_google_absl/absl/flags/parse.h' 'external/com_google_absl/absl/flags/internal/parse.h' 'mediapipe/framework/port/opencv_highgui_inc.h' 'mediapipe/framework/port/opencv_video_inc.h' 'mediapipe/framework/port/parse_text_proto.h' Target //mediapipe/examples/desktop/holistic_tracking_dll:MediapipeHolisticTracking failed to build

按照编译命令运行,一直在报这两个错

按照编译命令运行,运行一次报错误1,再运行1次报错误2。。。。一直这样
错误1.
mediapipe/examples/desktop/holistic_tracking_dll/ArmUpAndDownRecognition.cpp(27): error C2181: 没有匹配 if 的非法 else
mediapipe/examples/desktop/holistic_tracking_dll/ArmUpAndDownRecognition.cpp(36): error C2181: 没有匹配 if 的非法 else
错误2:
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(20): error C2065: “thumb_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(21): error C2065: “thumb_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(27): error C2065: “thumb_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(59): error C2065: “ring_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(60): error C2065: “ring_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(66): error C2065: “ring_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(70): error C2065: “pink_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(71): error C2065: “pink_vec1”: 未声明的标识符
mediapipe/examples/desktop/holistic_tracking_dll/GestureRecognition.cpp(77): error C2065: “pink_vec1”: 未声明的标识符

指针赋值的困惑

学习c++不久,有些代码没看懂,请教一下。
m_Video_InputStreamName = "input_video";

m_Video_OutputStreamName = "output_video";
m_PoseLandmarks_OutputStreamName = "pose_landmarks";
m_LeftHandLandmarks_OutputStreamName = "left_hand_landmarks";
m_RightHandLandmarks_OutputStreamName = "right_hand_landmarks";
m_FaceLandmarks_OutputStreamName = "face_landmarks";

像m_Video_OutputStreamName之类的不是指针吗,指针指向的不是地址吗?如果赋值的话不应该是*m_Video_OutputStreamName= “赋值”?

Build dll with hand_tracking_test fail

Hi,
I used the BUILD in hand_tracking_test to build the .dll,
but I got the wrong messenger,

In file included from mediapipe/examples/desktop/hand_tracking_test/hand_tracking_api.cpp:2:
mediapipe/examples/desktop/hand_tracking_test/hand_tracking_detect.h:14:10: fatal error: mediapipe/framework/port/parse_text_proto.h: No such file or directory
#include "mediapipe/framework/port/parse_text_proto.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Target //mediapipe/examples/desktop/hand_tracking_test:Mediapipe_Hand_Tracking failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.827s, Critical Path: 0.48s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully

Could you provide how can I build the .dll ?
Thank you.

在Win10下编译遇到问题

大神,在Win10下已经配置好C++编译环境,Hello World已经编译成功,但编译holistic_tracking_dll时遇到下面的错误,能帮看下是什么问题吗?多谢了

ERROR: C:/mediapipe/mediapipe/util/BUILD:161:11: Compiling mediapipe/util/annotation_renderer.cc failed: (Exit 2): cl.exe failed: error executing CppCompile command (from target //mediapipe/util:annotation_renderer)
cd /d C:/users/shaohg/_bazel_shaohg/3vmcl3ou/execroot/mediapipe
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
SET PWD=/proc/self/cwd
SET PYTHON_BIN_PATH=C:\Python38\python.exe
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\Users\shaohg\AppData\Local\Temp
SET TMP=C:\Users\shaohg\AppData\Local\Temp
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.obj.params

Configuration: 70734f78ae1345e7cb6cb3703cf7a2355f11024e083a50cfef3a781ff8a205a6

Execution platform: @local_execution_config_platform//:platform

mediapipe/util/annotation_renderer.cc(107): error C2660: 'DrawTextA': function does not take 1 arguments
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winuser.h(8171): note: see declaration of 'DrawTextA'
mediapipe/util/annotation_renderer.cc(533): error C2039: 'DrawTextA': is not a member of 'mediapipe::AnnotationRenderer'
.\mediapipe/util/annotation_renderer.h(48): note: see declaration of 'mediapipe::AnnotationRenderer'
mediapipe/util/annotation_renderer.cc(540): error C2065: 'image_width_': undeclared identifier
mediapipe/util/annotation_renderer.cc(540): error C2065: 'image_height_': undeclared identifier
mediapipe/util/annotation_renderer.cc(543): error C2065: 'image_height_': undeclared identifier
mediapipe/util/annotation_renderer.cc(545): error C2065: 'scale_factor_': undeclared identifier
mediapipe/util/annotation_renderer.cc(546): error C2065: 'scale_factor_': undeclared identifier
mediapipe/util/annotation_renderer.cc(547): error C2065: 'scale_factor_': undeclared identifier
mediapipe/util/annotation_renderer.cc(553): error C2065: 'scale_factor_': undeclared identifier
mediapipe/util/annotation_renderer.cc(552): error C2737: 'thickness': const object must be initialized
mediapipe/util/annotation_renderer.cc(556): error C3861: 'ComputeFontScale': identifier not found
mediapipe/util/annotation_renderer.cc(571): error C2065: 'scale_factor_': undeclared identifier
mediapipe/util/annotation_renderer.cc(569): error C2737: 'background_thickness': const object must be initialized
mediapipe/util/annotation_renderer.cc(574): error C2065: 'mat_image_': undeclared identifier
mediapipe/util/annotation_renderer.cc(576): error C2065: 'flip_text_vertically_': undeclared identifier
mediapipe/util/annotation_renderer.cc(578): error C2065: 'mat_image_': undeclared identifier
mediapipe/util/annotation_renderer.cc(580): error C2065: 'flip_text_vertically_': undeclared identifier
Target //mediapipe/examples/desktop/holistic_tracking_dll:MediapipeHolisticTracking failed to build
INFO: Elapsed time: 2.001s, Critical Path: 1.66s
INFO: 163 processes: 129 internal, 34 local.
ERROR: Build did NOT complete successfully

关于创建多线程使用时,除了第一个线程中能正确初始化模型,第二或者第三线程初始化失败。

您好,我将生成的动态库添加到我的工程中使用时,我想要创建多线程监控多个摄像头,这个时候出现以下问题:

  1. 第一个线程初始化能够初始化成功并正常运行模型;
  2. 接着后面的线程中初始化就失败了,init failed,当我打开第二个线程中的摄像头以后,第一个线程也检测不了了。

上面两个问题我不知道是动态库只能一个线程使用还是有哪些地方没有设置正确。如果可以,期待您能够给点建议。

祝您天天开心,事事如意。

mediapipe版本确认

你好,看了你的工程后,感觉写的很不错,我尝试复现你的工程,但是可能由于使用的mediapipe版本不一样,dll可以打包出来,但是在使用的时候,图像输出为黑屏,也没有手势识别结果。请问下你用的mediapipe是哪个版本的呢?能否提供你使用的版本的github下载链接啊?多谢

怎样自己编译得到可执行文件

作者您好,感谢您的分享。我按照您的步骤,已经顺利编译得到动态库,但是我没有看到得到可执行文件的编译文件和编译命令,如果我想自己编译得到可执行文件,需要怎么做呢,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.