mediapipe-rs/README.md

66 lines
1.8 KiB
Markdown
Raw Normal View History

2022-06-12 20:39:04 +02:00
# mediapipe-rs
2022-03-01 13:04:01 +01:00
2022-06-13 02:36:55 +02:00
Simple rust bindings for (mediapipe)[https://mediapipe.dev/].
2022-05-12 08:46:54 +02:00
2022-06-13 02:25:42 +02:00
Forked from: https://github.com/angular-rust/ux-mediapipe 🙏
2022-06-13 02:36:55 +02:00
2022-06-13 02:25:42 +02:00
And heavily based on this example: https://github.com/asprecic/mediapipe-qt-integration-example 🤌
2022-05-12 08:46:54 +02:00
## requirements
2022-06-11 21:53:07 +02:00
- [bazel](https://bazel.build/install)
2022-05-12 08:46:54 +02:00
## setup
2022-06-13 02:25:42 +02:00
Mediapipe is a framework for building AI-powered computer vision applications. It provides high level libraries exposing some of its solutions for common problems. This package makes some of these solutions available in Rust. In order to use it we must build a custom mediapipe C++ library.
Clone the modified Mediapipe repo.
2022-05-12 08:46:54 +02:00
```shell
git clone https://github.com/julesyoungberg/mediapipe.git
cd mediapipe
```
Build & install the mediagraph library.
### mac os
```shell
bazel build --define MEDIAPIPE_DISABLE_GPU=1 mediapipe:libmediagraph.dylib
sudo cp bazel-bin/mediapipe/libmediagraph.dylib /usr/local/lib/libmediagraph.dylib
2022-06-07 07:06:03 +02:00
cp mediapipe/mediagraph.h /usr/local/include/mediagraph.h
2022-05-12 08:46:54 +02:00
```
### linux (untested)
```shell
bazel build --define MEDIAPIPE_DISABLE_GPU=1 mediapipe:mediagraph
cp bazel-bin/mediapipe/libmediagraph.so /usr/local/lib/libmediagraph.so
2022-06-07 07:06:03 +02:00
cp mediapipe/mediagraph.h /usr/local/include/mediagraph.h
2022-05-12 08:46:54 +02:00
```
2022-06-11 21:35:38 +02:00
## examples
2022-06-13 02:46:38 +02:00
Examples are located in the `./examples` directory. Run `face_mesh.rs` with
2022-06-11 21:35:38 +02:00
```shell
2022-06-13 02:46:38 +02:00
cargo run --release --example face_mesh
2022-06-11 21:35:38 +02:00
```
2022-05-12 08:54:16 +02:00
## usage
Add the following to your dependencies list in `Cargo.toml`:
```toml
2022-06-12 20:39:04 +02:00
mediapipe = { git = "https://github.com/julesyoungberg/mediapipe-rs" }
2022-05-12 08:54:16 +02:00
```
Mediapipe relies on tflite files which must be available at `./mediapipe/modules/`. The easiest way to do this is
```shell
mkdir mediapipe
cp -R ../mediapipe/mediapipe/modules ./mediapipe/modules
```
2022-06-13 02:36:55 +02:00
The path to mediapipe may be different depending on where you have cloned it to.