https://github.com/ty70/stick-figure-generator
Automatically generate stick figures from photos of people. Detect postures with MediaPipe and draw with OpenCV. Overlay is also available.
https://github.com/ty70/stick-figure-generator
mediapipe opencv pose-estimation python stick-figure
Last synced: 2 months ago
JSON representation
Automatically generate stick figures from photos of people. Detect postures with MediaPipe and draw with OpenCV. Overlay is also available.
- Host: GitHub
- URL: https://github.com/ty70/stick-figure-generator
- Owner: ty70
- License: mit
- Created: 2025-05-20T02:32:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-13T08:59:11.000Z (about 1 year ago)
- Last Synced: 2025-10-06T00:42:33.541Z (9 months ago)
- Topics: mediapipe, opencv, pose-estimation, python, stick-figure
- Language: Python
- Homepage:
- Size: 149 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stick Figure Generator from Human Photos
This project uses Python and MediaPipe to detect human poses in photos and render them as simple stick figures.
## Features
* Uses MediaPipe pose estimation to detect human landmarks (joints)
* Draws stick figures based on the detected keypoints
* Optionally overlays the stick figure on the original image, or outputs a standalone figure on a white background
## Requirements
* Python 3.7 or higher
* mediapipe
* opencv-python
* numpy
You can install the required packages with:
```bash
pip install -r requirements.txt
```
## Directory Structure
```
.
├── inputs/
│ └── input.jpg
├── outputs/
│ └── output.jpg
├── scripts/
│ └── stick_figure.py
├── .gitignore
├── LICENSE
├── README_ja.md
├── README.md (you are here)
└── requirements.txt
```
## Usage
Run the following command from the project root directory:
```bash
python scripts/stick_figure.py --input inputs/input.jpg --output outputs/output.jpg --overlay True
```
Setting the `--overlay` option to `True` will overlay the stick figure on the original image. Setting it to `False` will draw the stick figure on a white background instead.
## Notes
* Input images should clearly contain a person. To ensure accurate pose detection, it is recommended to use images where the full body and face are visible.
* The output image will be saved to `outputs/output.jpg`.
## License
MIT [License](./LICENSE)
---
Special thanks to MediaPipe and OpenCV ❤️