Detects stopped buses at station platforms in real-time using CCTV video streams and dynamically configurable ROIs.
Detection results are written to shared memory for use by other processes (e.g., CGI scripts).
-
Dual Video Input Modes
- Live Mode: Receives real-time frames via shared memory (
/busbom_frame) - Video File Mode: Reads local
.mp4file for debugging (passed as command-line argument)
- Live Mode: Receives real-time frames via shared memory (
-
Dynamic ROI Configuration
- Receives ROI updates via Unix domain socket (
/tmp/roi_socket) from external tools like web CGI - No restart required to apply new ROI settings
- Receives ROI updates via Unix domain socket (
-
Multi-threaded Pipeline
- Independent threads for:
- Video reading
- Perspective warping
- Filtering & masking
- State analysis
- Independent threads for:
-
Robust State Stabilization (Debouncing)
- Stop condition is confirmed only if the bus is detected continuously for a set duration (e.g., 3 seconds)
- Up to 5 temporary detection losses (flickers) are tolerated within this window
-
Shared Memory Output
- Final result (
StopStatus) is written to/busbom_status - Used by CGI scripts or monitoring processes
- Final result (
- C++11 or newer
- OpenCV 4.x
- CMake ≥ 3.10
- POSIX threads (pthreads)
# Move to the project directory
cd /path/to/platform_observer
# Create and move into the build directory
mkdir -p build
cd build
# Run CMake and build the project
cmake ..
makeOutput binary:
build/station_checker
Used in production where another process streams frames to /busbom_frame.
./station_checkerUsed for testing with .mp4 files. Video must be placed under:
/home/Qwd/platform_observer/video/
Example:
./station_checker IMG_4403.mp4 +----------------------+
| Video Source | <- Shared Memory or File
+----------+-----------+
|
[frame_queue]
|
warp_thread
↓
[warped_queue]
↓
mask_thread
↓
[masked_queue]
↓
Main Thread (Analysis)
↓
Shared Memory (/busbom_status)
-
Video Input
- Reads from shared memory or a video file into
frame_queue
- Reads from shared memory or a video file into
-
ROI Configuration
- Listens to
/tmp/roi_socketfor ROI configuration - Updates platform count and ROI coordinates in real-time
- Listens to
-
Processing Threads
warp_thread: Applies perspective transformationmask_thread: Performs color filtering and masking
-
Detection & Stabilization
- Evaluates bus presence in each platform ROI
- Debounces results with time-based confirmation and flicker tolerance
-
Shared Memory Output
- Writes detection result to
/busbom_status - Readable by other components such as CGI scripts
- Writes detection result to