API Reference

Complete API documentation for the Self-Driving Vision Module

Object Detection API

detectObjects

POST

Detects objects in an image using YOLO v8 model. Returns bounding boxes, confidence scores, and class labels for detected objects.

Endpoint

POST /api/v1/detect-objects

Parameters

Parameter Type Required Description
image File Yes Image file (JPEG, PNG, BMP)
confidence float No Confidence threshold (0.0-1.0, default: 0.5)
model string No Model variant (yolov8n, yolov8s, yolov8m, yolov8l)
classes array No Filter specific object classes

Example Request

import requests url = "https://api.selfdriving-vision.com/v1/detect-objects" files = {"image": open("road_scene.jpg", "rb")} data = { "confidence": 0.6, "model": "yolov8m", "classes": ["person", "car", "truck", "bus"] } response = requests.post(url, files=files, data=data)

Response

Success Response (200 OK)
{ "status": "success", "detections": [ { "class": "car", "confidence": 0.94, "bbox": { "x": 245, "y": 156, "width": 89, "height": 67 }, "center": { "x": 289.5, "y": 189.5 } }, { "class": "person", "confidence": 0.87, "bbox": { "x": 123, "y": 203, "width": 34, "height": 78 }, "center": { "x": 140, "y": 242 } } ], "processing_time": 0.045, "model_version": "yolov8m-v1.2.3" }

getModelInfo

GET

Retrieves information about available detection models and their capabilities.

GET /api/v1/models
Success Response (200 OK)
{ "models": [ { "name": "yolov8n", "description": "YOLO v8 Nano - Fastest inference", "classes": ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck"], "avg_inference_time": 0.012, "model_size": "6.2MB", "mAP": 0.374 }, { "name": "yolov8l", "description": "YOLO v8 Large - Highest accuracy", "classes": ["person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck"], "avg_inference_time": 0.089, "model_size": "87.7MB", "mAP": 0.531 } ] }

Lane Detection API

detectLanes

POST

Detects lane boundaries in road images using computer vision algorithms. Returns lane lines with curvature and positioning information.

POST /api/v1/detect-lanes

Parameters

Parameter Type Required Description
image File Yes Road image file
algorithm string No Detection algorithm (canny, hough, cnn)
roi object No Region of interest coordinates
Success Response (200 OK)
{ "status": "success", "lanes": [ { "side": "left", "points": [ {"x": 120, "y": 400}, {"x": 135, "y": 350}, {"x": 150, "y": 300} ], "curvature": 0.0023, "confidence": 0.89 }, { "side": "right", "points": [ {"x": 680, "y": 400}, {"x": 665, "y": 350}, {"x": 650, "y": 300} ], "curvature": 0.0018, "confidence": 0.92 } ], "lane_width": 3.2, "vehicle_offset": -0.15, "processing_time": 0.034 }

Traffic Sign Recognition API

recognizeTrafficSigns

POST

Recognizes and classifies traffic signs in images using CNN models trained on traffic sign datasets.

POST /api/v1/recognize-traffic-signs

Parameters

Parameter Type Required Description
image File Yes Image containing traffic signs
confidence float No Minimum confidence threshold
categories array No Filter by sign categories
Success Response (200 OK)
{ "status": "success", "signs": [ { "class": "stop", "confidence": 0.95, "bbox": { "x": 245, "y": 156, "width": 89, "height": 89 }, "category": "regulatory", "description": "Stop sign - Come to a complete stop" }, { "class": "speed_limit_50", "confidence": 0.88, "bbox": { "x": 123, "y": 203, "width": 67, "height": 67 }, "category": "regulatory", "description": "Speed limit 50 km/h" } ], "processing_time": 0.067 }

Pedestrian Detection API

detectPedestrians

POST

Detects pedestrians in images with pose estimation and movement prediction capabilities.

POST /api/v1/detect-pedestrians

Parameters

Parameter Type Required Description
image File Yes Image containing pedestrians
pose_estimation boolean No Enable pose keypoint detection
movement_prediction boolean No Enable trajectory prediction
Success Response (200 OK)
{ "status": "success", "pedestrians": [ { "id": 1, "confidence": 0.92, "bbox": { "x": 123, "y": 203, "width": 34, "height": 78 }, "pose": { "head": {"x": 140, "y": 210}, "left_shoulder": {"x": 135, "y": 225}, "right_shoulder": {"x": 145, "y": 225}, "left_hip": {"x": 138, "y": 265}, "right_hip": {"x": 142, "y": 265} }, "movement": { "velocity": 1.2, "direction": 45.5, "predicted_position": {"x": 148, "y": 220} } } ], "processing_time": 0.089 }

Sensor Fusion API

fuseSensors

POST

Combines data from multiple sensors (camera, LiDAR, radar) to create a unified perception of the environment.

POST /api/v1/fuse-sensors

Parameters

Parameter Type Required Description
camera_data File Yes Camera image data
lidar_data File No LiDAR point cloud data
radar_data JSON No Radar detection data
fusion_algorithm string No Fusion method (kalman, bayesian, neural)
Success Response (200 OK)
{ "status": "success", "fused_objects": [ { "id": 1, "class": "car", "confidence": 0.94, "position": { "x": 15.2, "y": -2.1, "z": 0.5 }, "velocity": { "x": 12.5, "y": 0.0, "z": 0.0 }, "dimensions": { "length": 4.2, "width": 1.8, "height": 1.5 }, "sensor_contributions": { "camera": 0.6, "lidar": 0.8, "radar": 0.7 } } ], "processing_time": 0.156, "fusion_confidence": 0.89 }

Error Handling

HTTP Status Codes

Code Description
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
413 Payload Too Large - Image too large
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error

Error Response Format

{ "status": "error", "error": { "code": "INVALID_IMAGE_FORMAT", "message": "Unsupported image format. Please use JPEG, PNG, or BMP.", "details": { "received_format": "GIF", "supported_formats": ["JPEG", "PNG", "BMP"] } }, "timestamp": "2024-01-15T10:30:00Z" }