A lightweight C++ utility module for multithreaded pipeline components and JSON handling.
Includes a flexible StageBase class for real-time data processing and tools for loading, validating, and writing structured JSON files using RapidJSON.
This module is part of my ROS/ROS2 real-time 3D tracker and its docker-implementation.
If you use this software, please use the GitHub “Cite this repository” button at the top(-right) of this page.
- Load and validate JSON documents with optional schema support
- Save structured JSON objects to disk
- Automatically timestamp JSON metadata
- Scan directories for JSON or config files
- Simple status bar
- Batch Video Iterator, iterate over a batch of videos frame-by-frame
A generic, thread-safe, multi-stage processing base class for building C++ pipelines.
Features:
- Threaded input/output FIFOs
- Customizable
ProcessFunction - Hooks for completion callbacks
- Runtime-safe termination and thread joining
Note: The general layout of
StageBasewas developed as part of Cheng Minghao's PhD work.
Include this repo as a submodule or CMake interface library in larger projects, such as:
- C++17
- OpenCV 4.10.0
- spdlog
- RapidJSON (included or linked)
- Standard C++ libraries (
<mutex>,<thread>,<queue>,<chrono>, etc.)
cpp_utils::Document config;
cpp_utils::load_json_with_schema("config.json", "schema.json", 8192, config);class MyStage : public cpp_utils::StageBase<MyInput, MyOutput> {
bool ProcessFunction(MyInput& input, MyOutput& output) override {
// process input -> output
return true;
}
};- JSON loading and schema support based on RapidJSON
- Stage Base Template was initially designed in Cheng Minghao's PhD and adjusted for online-tracking.