This project is a simple example for a Server for the CG3 AR Sandbox. It is intended as a starting point to easily implement more sophisticated applications into an ar sandbox without handling any of the complicated stuff like depth acquisition, threading or calibration.
- Extracts parameters and pixel data from the request.
- Applies false color mapping to the depth image.
- Returns the processed image as a base64-encoded string in a JSON response.
- Handles errors gracefully and returns appropriate error messages.
-
Clone the repository:
git clone https://github.com/SimonVirgo/depth-image-processing-api.git cd depth-image-processing-api -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
-
Run the Sandbox application
-
Go to the Server Module and fill out ip, port and endpoint.
-
hit Start
app.py: Main Flask application file.sandbox_frame.py: Contains theSandboxFrameclass for processing depth images.requirements.txt: Lists the dependencies required for the project.
Description: Processes the depth image data and returns the false color image.
Parameters:
width(int): The width of the depth image.height(int): The height of the depth image.minDepth(float): The minimum depth value in the image.maxDepth(float): The maximum depth value in the image.
Request Body: Raw binary data of the depth image.
Response:
200 OK: Returns a JSON object with the base64-encoded false color image.400 Bad Request: Returns a JSON object with an error message if there is an issue with the request.