mediapipe-rs/README.md

76 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2022-06-12 20:39:04 +02:00
# mediapipe-rs
2022-03-01 13:04:01 +01:00
2022-06-14 05:59:28 +02:00
Simple rust bindings for [mediapipe](https://mediapipe.dev/).
2022-05-12 08:46:54 +02:00
2024-01-02 15:34:15 +01:00
Forked from: https://github.com/julesyoungberg/mediapipe-rs
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
To run the examples clone this project.
```shell
2024-01-02 15:34:15 +01:00
git clone https://gitea.cass-dlcm.dev/cassdlcm/mediapipe-rs.git
```
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 next to `mediapipe-rs` or a project that uses `mediapipe-rs`.
2022-05-12 08:46:54 +02:00
```shell
2024-01-02 15:34:15 +01:00
git clone https://gitea.cass-dlcm.dev/cassdlcm/mediapipe.git
2022-05-12 08:46:54 +02:00
cd mediapipe
```
### building mediapipe
2022-05-12 08:46:54 +02:00
Build & install the mediagraph library.
#### mac os
2022-05-12 08:46:54 +02:00
```shell
2024-01-02 15:34:15 +01:00
bazel build mediapipe:libmediagraph.dylib
2022-05-12 08:46:54 +02:00
sudo cp bazel-bin/mediapipe/libmediagraph.dylib /usr/local/lib/libmediagraph.dylib
sudo cp mediapipe/mediagraph.h /usr/local/include/mediagraph.h
2022-05-12 08:46:54 +02:00
```
#### linux (untested)
2022-05-12 08:46:54 +02:00
```shell
2024-01-02 15:34:15 +01:00
bazel build mediapipe:mediagraph
sudo cp bazel-bin/mediapipe/libmediagraph.so /usr/local/lib/libmediagraph.so
sudo cp mediapipe/mediagraph.h /usr/local/include/mediagraph.h
```
2022-07-27 02:50:24 +02:00
### linking
2022-07-27 02:50:24 +02:00
Navigate to the project directory and create a symbolic link to `../mediapipe/mediapipe`.
```shell
cd ../mediapipe-rs # or the path to your project
ln -s ../mediapipe/mediapipe .
2022-05-12 08:46:54 +02:00
```
2022-05-12 08:54:16 +02:00
## usage
Add the following to your dependencies list in `Cargo.toml`:
```toml
2024-01-02 15:34:15 +01:00
mediapipe = { git = "https://gitea.cass-dlcm.dev/cassdlcm/mediapipe-rs" }
2022-05-12 08:54:16 +02:00
```
2022-07-27 02:50:24 +02:00
Mediapipe relies on tflite files which must be available at `./mediapipe/modules/`. The easiest way to satisfy this is by creating a symbolic link to mediapipe as explained in the `linking` section above.
2022-06-15 22:01:42 +02:00
## examples
Examples are located in the `./examples` directory. Run `face_mesh.rs` with
```shell
cargo run --release --example face_mesh
```