JointTrack API
Annotate images with range of motion angles and highlight specific joints.
Getting Started with the JointTrack API
Prerequisites
- A valid API key for the JointTrack service. You can obtain one by signing up for a free trial or purchasing a plan on the service's website.
- A tool for making HTTP requests, such as cURL or Postman, or any other client that generates such requests.
Detecting a Pose in an Image
To detect a pose in an image, you need to make a POST request to the /detect endpoint of the API. The request should include the following information:- The image to be processed, either as an image URL or embedded image data in base64 format
- (Optional) Information about the model and version to be used for pose detection
curl -X POST "https://api.flow.org.es/jointtrack/v1/detect"
-H "X-API-Key: <Your API KEY>"
-H "Content-Type: multipart/form-data"
-F 'image=@image.jpg'
-F 'measurement=shoulder_abduction'
-F 'side=both'
In this example, the image data to be processed is embedded in request, neck rotation left will be measured using latest version of default model for joint tracking.
Supported values for measurement parameter:- shoulder_abduction - Shoulder Abduction
- shoulder_forward_flexion- Shoulder Forward Flexion
- back_side_flexion - Back Side Flexion
- back_lumbar_forward_flexion- Lumbar Forward Flexion
- back_lumbar_extension- Lumbar Extension
- knee_flexion- Knee Flexion
- knee_extension- Knee Extension
- neck_lateral_flexion- Neck Lateral Flexion
- neck_extension- Neck Extension
- splits- Splits
- squats_knee_front-Squats Knee (front view)
- squats_hip_front- Squats Hip (front view)
- squats_hip_side- Squats Hip (side view)
- elbow_side- Elbow (side view)
- hip_side- Hip (side view)
- knee_side- Knee (side view)
- elbow_side,hip_side,knee_side- Check sitting pose by measuring elbow, hip and knee angles (side view)
- left - Left side
- right - Right side
- both - Left and Right side
{
"status":"ok",
"image":{
"data":"data:image/jpeg;base64,<base64 encoded original image>",
"width":612,
"height":403
},
"measurements":[
{
"name":"shoulder_abduction",
"title":"Shoulder Abduction",
"bodyPart":"shoulder",
"value":{
"left":123,
"right":115
},
"image":{
"data":"data:image/jpeg;base64,<base64 encoded image with measurement overlay>",
"width":612,
"height":403
}
}
]
}
If the request is successful, the status field will be set to success and the measurements field will contain joint measurements requested.
Troubleshooting
If you encounter any issues while using the API, here are a few things you can try:- Check that your API key is valid and that you're including it in the request headers.
- Make sure that the embedded image data is correct.
- Check that the request body is correctly formatted in JSON and that it includes all the required fields.
- Check the API documentation for information on error codes and troubleshooting tips.
- If you continue to have issues, reach out to the API support team for assistance.
Code Examples
Python
import requests
import os
def call_api(api_key, measurement, side, image_path):
url = 'https://api.flow.org.es/jointtrack/v1/detect'
headers = {
'X-API-KEY': api_key,
}
# Ensure the file exists
if not os.path.exists(image_path):
print(f"Image file does not exist: {image_path}")
return
# 'rb' means read the file in binary mode
with open(image_path, 'rb') as image_file:
files = {
'image': image_file
}
data = {
'measurement': measurement,
'side': side,
}
response = requests.post(url, headers=headers, files=files, data=data)
# Handle response
if response.status_code == 200:
print(response.json())
else:
print(f"API call failed with status code {response.status_code}.")
if response.text:
print(response.text)
def main():
api_key = ''
measurement = 'shoulder_abduction'
side = 'both'
image_path = 'image.jpg'
call_api(api_key, measurement, side, image_path)
if __name__ == "__main__":
main()