API Reference

Every request type documented with its parameters and response format. All communication uses TCP JSON on port 10210.

Protocol Overview

All requests are sent as JSON over a TCP connection to the server (default localhost:10210). Each request must include a request_id and a type field. Messages are newline-delimited.

Responses echo the request_id and include a result object on success or an error string on failure.

Computer Vision

detect_objects Object Detection

Detect and classify objects in an image using YOLOv5.

Request

1{
2  "request_id": "string",
3  "type": "detect_objects",
4  "image_path": "string",
5  "confidence_threshold": 0.5
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "objects": [
5      {
6        "class": "string",
7        "confidence": 0.0,
8        "bbox": { "x": 0, "y": 0, "w": 0, "h": 0 }
9      }
10    ]
11  }
12}
estimate_depth Depth Estimation

Generate a monocular depth map from a single image.

Request

1{
2  "request_id": "string",
3  "type": "estimate_depth",
4  "image_path": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "depth_map_path": "string",
5    "colormap": "JET",
6    "width": 0,
7    "height": 0
8  }
9}
segment_image Image Segmentation

Segment an image into K regions using K-means clustering.

Request

1{
2  "request_id": "string",
3  "type": "segment_image",
4  "image_path": "string",
5  "num_segments": 5
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "segments": ["string"],
5    "num_segments": 5
6  }
7}
detect_keypoints Keypoint Detection

Detect feature keypoints for matching and tracking.

Request

1{
2  "request_id": "string",
3  "type": "detect_keypoints",
4  "image_path": "string",
5  "method": "ORB",
6  "max_keypoints": 500
7}

Response

1{
2  "request_id": "string",
3  "result": {
4    "keypoints": [
5      { "x": 0, "y": 0, "size": 0.0, "angle": 0.0, "response": 0.0 }
6    ],
7    "count": 0,
8    "method": "ORB"
9  }
10}
detect_edges Edge Detection

Detect edges using Canny, Sobel, or Laplacian methods.

Request

1{
2  "request_id": "string",
3  "type": "detect_edges",
4  "image_path": "string",
5  "method": "canny",
6  "threshold1": 50,
7  "threshold2": 150
8}

Response

1{
2  "request_id": "string",
3  "result": {
4    "edge_map_path": "string",
5    "method": "canny",
6    "width": 0,
7    "height": 0
8  }
9}
analyze_histogram Histogram Analysis

Compute color histograms and statistics for an image.

Request

1{
2  "request_id": "string",
3  "type": "analyze_histogram",
4  "image_path": "string",
5  "channels": ["red", "green", "blue"]
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "histograms": {
5      "red": { "mean": 0.0, "std_dev": 0.0, "bins": 256 },
6      "green": { "mean": 0.0, "std_dev": 0.0, "bins": 256 },
7      "blue": { "mean": 0.0, "std_dev": 0.0, "bins": 256 }
8    },
9    "histogram_image_path": "string"
10  }
11}

Image Processing

resize_image Resize

Resize an image with configurable interpolation.

Request

1{
2  "request_id": "string",
3  "type": "resize_image",
4  "image_path": "string",
5  "width": 800,
6  "height": 600,
7  "method": "lanczos"
8}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "original_size": { "width": 0, "height": 0 },
6    "new_size": { "width": 800, "height": 600 }
7  }
8}
crop_image Crop

Extract a region from an image.

Request

1{
2  "request_id": "string",
3  "type": "crop_image",
4  "image_path": "string",
5  "x": 100,
6  "y": 50,
7  "width": 500,
8  "height": 400
9}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "crop_region": { "x": 100, "y": 50, "w": 500, "h": 400 }
6  }
7}
rotate_image Rotate

Rotate an image by an arbitrary angle.

Request

1{
2  "request_id": "string",
3  "type": "rotate_image",
4  "image_path": "string",
5  "angle": 45,
6  "background": "#FFFFFF"
7}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "angle": 45,
6    "new_size": { "width": 0, "height": 0 }
7  }
8}
flip_image Flip

Flip an image horizontally or vertically.

Request

1{
2  "request_id": "string",
3  "type": "flip_image",
4  "image_path": "string",
5  "direction": "horizontal"
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "direction": "horizontal"
6  }
7}
apply_filter Color Filters

Apply color adjustments and artistic filters.

Request

1{
2  "request_id": "string",
3  "type": "apply_filter",
4  "image_path": "string",
5  "filters": [
6    { "type": "brightness", "value": 1.2 },
7    { "type": "contrast", "value": 1.1 },
8    { "type": "grayscale" }
9  ]
10}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "filters_applied": ["brightness", "contrast", "grayscale"]
6  }
7}
blur_image Blur

Apply Gaussian, box, or median blur to an image.

Request

1{
2  "request_id": "string",
3  "type": "blur_image",
4  "image_path": "string",
5  "method": "gaussian",
6  "radius": 5,
7  "sigma": 2.0
8}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "method": "gaussian",
6    "radius": 5
7  }
8}
sharpen_image Sharpen

Sharpen an image using unsharp mask.

Request

1{
2  "request_id": "string",
3  "type": "sharpen_image",
4  "image_path": "string",
5  "amount": 1.5,
6  "radius": 2
7}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "amount": 1.5,
6    "radius": 2
7  }
8}
imagemagick_transform ImageMagick Transform

Apply advanced ImageMagick operations.

Request

1{
2  "request_id": "string",
3  "type": "imagemagick_transform",
4  "image_path": "string",
5  "operations": [
6    { "op": "convert", "format": "png" },
7    { "op": "effect", "name": "oil_paint", "radius": 4 }
8  ]
9}

Response

1{
2  "request_id": "string",
3  "result": {
4    "output_path": "string",
5    "operations_applied": 2,
6    "output_format": "png"
7  }
8}

Text Analysis & NLP

word_count Word Count

Count words, characters, sentences, and paragraphs.

Request

1{
2  "request_id": "string",
3  "type": "word_count",
4  "text": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "words": 0,
5    "characters": 0,
6    "characters_no_spaces": 0,
7    "sentences": 0,
8    "paragraphs": 0,
9    "lines": 0
10  }
11}
spell_check Spell Check

Check spelling and suggest corrections.

Request

1{
2  "request_id": "string",
3  "type": "spell_check",
4  "text": "string",
5  "language": "en"
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "errors": [
5      {
6        "word": "string",
7        "position": 0,
8        "suggestions": ["string"]
9      }
10    ],
11    "error_count": 0
12  }
13}
readability_score Readability Score

Compute readability metrics for text.

Request

1{
2  "request_id": "string",
3  "type": "readability_score",
4  "text": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "flesch_reading_ease": 0.0,
5    "flesch_kincaid_grade": 0.0,
6    "gunning_fog": 0.0,
7    "coleman_liau": 0.0,
8    "automated_readability": 0.0,
9    "grade_level": "string"
10  }
11}
analyze_sentiment Sentiment Analysis

Classify text sentiment with confidence scoring.

Request

1{
2  "request_id": "string",
3  "type": "analyze_sentiment",
4  "text": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "sentiment": "positive",
5    "score": 0.0,
6    "confidence": 0.0,
7    "breakdown": {
8      "positive_words": ["string"],
9      "negative_words": ["string"],
10      "intensifiers": ["string"]
11    }
12  }
13}
extract_entities Entity Extraction

Extract named entities from text.

Request

1{
2  "request_id": "string",
3  "type": "extract_entities",
4  "text": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "entities": [
5      {
6        "text": "string",
7        "type": "PERSON",
8        "start": 0,
9        "end": 0
10      }
11    ],
12    "entity_count": 0
13  }
14}
detect_language Language Detection

Identify the language of input text.

Request

1{
2  "request_id": "string",
3  "type": "detect_language",
4  "text": "string"
5}

Response

1{
2  "request_id": "string",
3  "result": {
4    "language": "en",
5    "language_name": "English",
6    "confidence": 0.0,
7    "alternatives": [
8      { "language": "string", "language_name": "string", "confidence": 0.0 }
9    ]
10  }
11}
tokenize Tokenization

Tokenize text into words or sentences.

Request

1{
2  "request_id": "string",
3  "type": "tokenize",
4  "text": "string",
5  "mode": "word"
6}

Response

1{
2  "request_id": "string",
3  "result": {
4    "tokens": ["string"],
5    "count": 0,
6    "mode": "word"
7  }
8}

Start Building with the API

Connect to the server and start processing media in any language that supports TCP sockets.

Getting Started Guide