Human Pose Estimation with mediapipe
Run with osc for UE4
python3 hpe_win.py
The script accepts the following arguments in "config.yml" file:
- address_input - file path or webcam index
- scale_pose - shoulder width in metric system
- crop_image - coefficient if you need to resize the image
- osc_address - address for osc client
- osc_port - port for osc client
- osc_message_address - address for message output via osc client
- output_method (['file', 'osc']) - output type via file or osc client
- mirror_image - horizontal display of the output image
- show_image - output image output via opencv
- apose - send only APose coordinate
- world - world or local values of rotation and rotation
- old_world - old convrerting model (does not work anymore)
To test with matplotlib, you need to run a script (example with a webcam with index 0):
python3 hpe_videocapture.py 0
Dependencies
Python libraries:
- mediapipe
- numpy
- matplotlib (could be optional)
- opencv-python
- json
- python-osc
The mediapipe library requires the cuda toolkit and cudnn to work with the gpu.
Interface for hpe_videocapture
For one-time rendering of points in 3D using matplotlib, you need to press the 'm' key.
To write the converted data to the UE4 model in the file 'hierarchy_data.json', you need to press the 'j' key.
To close the program, press the 'esc' key.
Requirements for setting up an experiment
- There must be one person in the frame.
- The camera should be approximately at a 90 degree angle.
- The person must enter the frame entirely.
- It is desirable that the contours of the clothes on the person are clearly visible.
Build on Windows
In development
Запуск
Для тестового запуска через вебкамеру с индексом 0.
python3 hpe_json.py --address_input 0 --show_image True
Скрипт принимает следующие аргументы:
- '--address_input' (type=str, default="0"): путь к файлу или индекс вебкамеры
- '--scale_pose' (type=float, default=0.42): ширина плеч в метрической системе
- '--crop_image' (type=float, default=1.0): коэффициент, если нужно изменить размер изображения
- '--osc_address' (type=str, default="0.0.0.0"): ip-адрес для osc клиента
- '--osc_port' (type=int, default="5005"): порт для osc клиента
- '--osc_message_address' (type=str, default="/pose/0"): адрес для вывода сообщения через osc клиент
- '--output_method' (type=str, default='file', choices=['file', 'osc']): тип вывода через файл или osc клиент
- '--mirror_image' (type=bool, default=True): горизнтальное отображение выходного изображения
- '--show_image' (type=bool, default=False): вывод выходного изображения через opencv
Для теста с matplotlib нужно запустить скрипт (пример с вебкамерой с индексом 0):
python3 hpe_videocapture.py 0
Description
Languages
Python
100%