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
Here's an example of a cURL
command to detect a pose in an image:
curl -X POST "https://api.quickpose.ai/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 Abductionshoulder_forward_flexion
- Shoulder Forward Flexionshoulder_extension
- Shoulder Extensionback_side_flexion
- Back Side Flexionback_lumbar_forward_flexion
- Lumbar Forward Flexionback_lumbar_extension
- Lumbar Extensionknee_flexion
- Knee Flexionknee_extension
- Knee Extensionneck_lateral_flexion
- Neck Lateral Flexionneck_forward_flexion
- Neck Forward Flexionneck_extension
- Neck Extensionsplits
- Splitssquats_knee_front
- Squats Knee (front view)squats_knee_side
- Squats Knee (side 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)
Parameter measurement
supports also multiple values separated by comma. Example:
elbow_side,hip_side,knee_side
- Check sitting pose by measuring elbow, hip and knee angles (side view)
Supported values for side
parameter:
left
- Left sideright
- Right sideboth
- Left and Right side
The API will return a JSON object with the following information:
{
"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.quickpose.ai/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 = '<api key>'
measurement = 'shoulder_abduction'
side = 'both'
image_path = 'image.jpg'
call_api(api_key, measurement, side, image_path)
if __name__ == "__main__":
main()