update/car-in_no_fueling//next: car-in_fueling

This commit is contained in:
Pongsatorn 2025-08-29 19:05:10 +07:00
parent 5875b76d74
commit 72eb7d55ea
7 changed files with 4184 additions and 357 deletions

172
MULTI_CAMERA_GUIDE.md Normal file
View file

@ -0,0 +1,172 @@
# 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
```bash
# 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
```bash
# 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
```bash
python multi_camera_simulator.py <camera_id>
```
### Advanced Options
```bash
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:
1. **Multiple simultaneous detections** - Cars detected by different cameras
2. **Session isolation** - Each camera gets separate session IDs
3. **LPR processing** - License plate results for different cameras
4. **Database updates** - Multiple car records with different session IDs
### Test Scenario
1. Start all 4 cameras
2. Connect all 4 to detector worker
3. Show car to webcam (all cameras see it)
4. Each camera should get separate session ID
5. Send LPR results for each session ID
6. Verify database updates for each camera
## 🔧 Troubleshooting
### Port Already in Use
If you see port conflicts:
```bash
# 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
```bash
# 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
```bash
# Disable RTSP if FFmpeg unavailable
python multi_camera_simulator.py 1 --no-rtsp
```
## 💡 Pro Tips
1. **Start cameras in order** (1, 2, 3, 4) for easier tracking
2. **Use different terminals** for each camera to see individual logs
3. **Check status endpoints** for health monitoring:
- `http://10.101.1.4:8080/status`
- `http://10.101.1.4:8081/status`
- etc.
4. **Monitor logs** to see which camera is processing which detection
5. **Test LPR with unique session IDs** from each camera
This setup provides a realistic multi-camera environment for comprehensive LPR integration testing! 🎉