REST Spot Example
This example demonstrates spot physiological measurements with file output using the SmartSpectra C++ SDK and REST API integration.
Overview
The REST spot example shows how to:
- Perform single spot measurements (30 seconds by default)
- Use REST API integration for physiological processing
- Process video from camera or file input
- Output results to both console and files
- Handle comprehensive command-line configuration
Key Features
- Spot measurement mode - Single measurement session rather than continuous monitoring
- REST API integration - Uses HTTP REST calls to the Physiology API
- File output - Saves results to disk for analysis
- Flexible input - Supports both camera and video file sources
- Comprehensive CLI - Extensive command-line options for configuration
Usage
# Build the example (from smartspectra/cpp directory)
cmake --build build --target rest_spot_example
# Run with camera input (30-second measurement)
./build/samples/rest_spot_example/rest_spot_example --also_log_to_stderr --camera_device_index=0 --auto_lock=false --api_key=YOUR_API_KEY_HERE
# Run with video file input
./build/samples/rest_spot_example/rest_spot_example --also_log_to_stderr --input_video_path=/path/to/video.mp4 --api_key=YOUR_API_KEY_HERE
# Run with custom measurement duration (60 seconds)
./build/samples/rest_spot_example/rest_spot_example --also_log_to_stderr --camera_device_index=0 --spot_duration_s=60 --api_key=YOUR_API_KEY_HERE
Configuration
Key configuration options include:
- --api_key: Your Physiology REST API key (required)
- --spot_duration_s: Duration of measurement in seconds (default: 30)
- --camera_device_index: Camera to use for input (default: 0)
- --input_video_path: Path to video file for processing
- --output_file_path: Path for output files
For complete options, run:
./rest_spot_example --help=main
Output
The example generates:
- Console output - Real-time logging and final results
- JSON files - Structured physiological data
- Log files - Detailed processing information
- Status files - Processing status indicators
Code Structure
The example demonstrates:
- Command-line Processing - Comprehensive argument parsing with Abseil flags
- Settings Configuration - Spot measurement and REST integration setup
- Container Management - SmartSpectra processing container lifecycle
- File I/O Operations - Reading input and writing output files
- Error Handling - Robust error checking and status reporting
- Data Processing - Physiological metrics extraction and formatting
This example is ideal for batch processing applications, research workflows, or scenarios where you need to analyze pre-recorded video content for physiological data.