4.9 KiB
4.9 KiB
Multi-Camera Simulation Guide
This guide explains how to simulate 4 cameras using a single webcam for testing the LPR integration in a realistic multi-camera environment.
🎯 Purpose
Simulate 4 real-world cameras to test:
- Multiple camera streams with car detection
- LPR integration across different cameras
- Session management for multiple simultaneous detections
- Database updates from different camera sources
🚀 Quick Start
Windows
# Option 1: Use batch file (opens 4 terminal windows)
start_4_cameras.bat
# Option 2: Manual start (run each in separate terminal)
python multi_camera_simulator.py 1
python multi_camera_simulator.py 2
python multi_camera_simulator.py 3
python multi_camera_simulator.py 4
Linux/macOS
# Option 1: Use shell script (opens 4 terminal windows)
./start_4_cameras.sh
# Option 2: Manual start (run each in separate terminal)
python3 multi_camera_simulator.py 1
python3 multi_camera_simulator.py 2
python3 multi_camera_simulator.py 3
python3 multi_camera_simulator.py 4
📡 Camera URLs
Each simulated camera will have unique URLs:
Camera | HTTP Snapshot | RTSP Stream | Visual ID |
---|---|---|---|
1 | http://10.101.1.4:8080/snapshot |
rtsp://10.101.1.4:8550/stream |
Yellow border |
2 | http://10.101.1.4:8081/snapshot |
rtsp://10.101.1.4:8551/stream |
Magenta border |
3 | http://10.101.1.4:8082/snapshot |
rtsp://10.101.1.4:8552/stream |
Green border |
4 | http://10.101.1.4:8083/snapshot |
rtsp://10.101.1.4:8553/stream |
Blue border |
🎨 Visual Differentiation
Each camera adds visual branding to help distinguish streams:
- Camera 1: Yellow border + "CAMERA 1" text
- Camera 2: Magenta border + "CAMERA 2" text
- Camera 3: Green border + "CAMERA 3" text
- Camera 4: Blue border + "CAMERA 4" text
- All: Timestamp with camera ID
🔧 Configuration Options
Basic Usage
python multi_camera_simulator.py <camera_id>
Advanced Options
python multi_camera_simulator.py 1 --webcam-index 0 --base-port 8080 --rtsp-base-port 8550
python multi_camera_simulator.py 2 --no-rtsp # HTTP only
Parameters
camera_id
: Required (1-4)--webcam-index
: Webcam device index (default: 0)--base-port
: Base HTTP port (default: 8080)--rtsp-base-port
: Base RTSP port (default: 8550)--no-rtsp
: Disable RTSP streaming
🏗️ CMS Configuration
Configure each camera in your CMS with these settings:
Camera 1
Camera Identifier: webcam-camera-01
Snapshot URL: http://10.101.1.4:8080/snapshot
RTSP URL: rtsp://10.101.1.4:8550/stream
Snapshot Interval: 2000
Camera 2
Camera Identifier: webcam-camera-02
Snapshot URL: http://10.101.1.4:8081/snapshot
RTSP URL: rtsp://10.101.1.4:8551/stream
Snapshot Interval: 2000
Camera 3
Camera Identifier: webcam-camera-03
Snapshot URL: http://10.101.1.4:8082/snapshot
RTSP URL: rtsp://10.101.1.4:8552/stream
Snapshot Interval: 2000
Camera 4
Camera Identifier: webcam-camera-04
Snapshot URL: http://10.101.1.4:8083/snapshot
RTSP URL: rtsp://10.101.1.4:8553/stream
Snapshot Interval: 2000
🧪 Testing LPR Integration
With 4 cameras running, you can test:
- Multiple simultaneous detections - Cars detected by different cameras
- Session isolation - Each camera gets separate session IDs
- LPR processing - License plate results for different cameras
- Database updates - Multiple car records with different session IDs
Test Scenario
- Start all 4 cameras
- Connect all 4 to detector worker
- Show car to webcam (all cameras see it)
- Each camera should get separate session ID
- Send LPR results for each session ID
- Verify database updates for each camera
🔧 Troubleshooting
Port Already in Use
If you see port conflicts:
# Check what's using the port
netstat -an | findstr :8080
netstat -an | findstr :8550
# Use different base ports
python multi_camera_simulator.py 1 --base-port 9080 --rtsp-base-port 9550
Webcam Access Issues
# Try different webcam indices
python multi_camera_simulator.py 1 --webcam-index 1
# Check available cameras
python -c "import cv2; print([i for i in range(10) if cv2.VideoCapture(i).isOpened()])"
FFmpeg Issues
# Disable RTSP if FFmpeg unavailable
python multi_camera_simulator.py 1 --no-rtsp
💡 Pro Tips
- Start cameras in order (1, 2, 3, 4) for easier tracking
- Use different terminals for each camera to see individual logs
- Check status endpoints for health monitoring:
http://10.101.1.4:8080/status
http://10.101.1.4:8081/status
- etc.
- Monitor logs to see which camera is processing which detection
- Test LPR with unique session IDs from each camera
This setup provides a realistic multi-camera environment for comprehensive LPR integration testing! 🎉