drawPoses
warning
The document is a continuation of the previous document, if you have landed directly on this page then, Please read from page Get started.
#
What is drawPoses component ?drawPoses component is used to draw the detected points(pose) on image.
- Description : drawPoses() takes an input a json string with base64 image, and detected poses information(detected points with probability) and returns base64 string with drawn values on image. Check Input and output parameters for details.
- Parameters :
- Input(Via STDIN) : A JSON String with following contents:
- Input1: For each detected pose
- detected point
- Probability for each point
- Input2: Original image in base64 string format
- Input1: For each detected pose
- Output(Via STDOUT) : A JSON string with following contents
- Base64 image string with drawn pose
- int responseID
- Input(Via STDIN) : A JSON String with following contents:
#
List of drawPoses features in shunya stack- Get Image with drawn pose detections
#
Using drawPosesdrawPoses
#
Requirements to use - Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices)
- Shunya AI installed in Shunya OS.
drawPoses
#
Steps to use - Give pose data JSON as an input.
- Get Image with drawn pose detections
note
Run the steps given below inside Shunya OS installed (supported Arm devices) or Shunya OS docker container (X86 based windows/linux devices) terminals.
Lets take an example use case: Say we need to
- Give detected poses information as as input in JSON format
- Get JSON output of all the detected poses drawn on image.
Steps are
#
1. Give pose data JSON as an input.Start with an ready to use template for drawing poses on image.
Open the examples in a text editor and modify as per your usecase.
- For CPP you will find the examples in the folder
cpp-examples/pose-estimation/drawPoses
- Open the file
draw_poses.cpp
- Modify the line to set the input json string
- For Python you will find the examples in the folder
python-examples/pose-estimation/drawPoses
- Open the file
draw_poses.py
- Modify the line to set the input json string
- For CPP you will find the examples in the folder
#
2. Get Image with drawn pose detectionsOnce you are done editing, save and run the code, by running
Running the codes will print the JSON output on the terminal (to STDOUT).
For Example:
Lets say the input image is
Input JSON containing pose data is
Then the JSON output is
#
Understand this component with an example (ready to use code)This is an example for pose-estimation and here we will be using 2 components: detectPoses and drawPoses
Check this ready to use example in c++ and python
Download the code
```shell git clone https://gitlab.iotiot.in/shunya/products/shunya-ai-examples.git cd shunya-ai-examples/python-examples/pose-estimation ```In this folder there is a file, pose_detect.cpp or pose_detect.py
detectbjects Components used
```shell detectPoses = Popen(['/usr/bin/detectPoses'], stdout=PIPE, stdin=PIPE) ```drawPoses component used
```shell drawPoses = Popen(['/usr/bin/drawPoses'], stdout=PIPE, stdin=PIPE) ```Run code by yourself
- You will get a new image stored in system.```shell python3 pose_estimate.py ```