How adarshdev200/trinetra-8bitbite works
TRIMUKH is a temple crowd-safety platform. Camera video is processed into zone counts and entrance/exit events; the backend updates occupancy and gate state, then serves live status to the protected command-center pages. Wearable SOS positions and barricade guidance are additional hardware branches. The main implementation links are supported by excerpts and README documentation; frontend feature-page internals and some hardware wiring were not sampled, so those connections are shown only where documented.
Main entry points: server.js API & Socket Server · zone_pipeline.py Zone Pipeline · main.py CV Runner · App.jsx App & Protected Routes
Components 24
Vision & Zone Counting
- CV Runner
mandir-crowd-monitor/cv-engine/main.py - Zone Pipeline
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Person Detector
mandir-crowd-monitor/cv-engine/src/detector.py - Line Counter
mandir-crowd-monitor/cv-engine/src/line_counter.py - Occupancy Counter
mandir-crowd-monitor/cv-engine/src/counter.py - Annotated Feeds
mandir-crowd-monitor/cv-engine/src/web_stream.py - Backend Signal Client
mandir-crowd-monitor/cv-engine/src/signal_client.py
Backend & Live State
- API & Socket Server
mandir-crowd-monitor/backend/server.js - Occupancy & Gate State
mandir-crowd-monitor/backend/src/state.js - Gate Threshold Logic
mandir-crowd-monitor/backend/src/gate.js - State & Event Models
mandir-crowd-monitor/backend/src/models.js - Band Positions
mandir-crowd-monitor/backend/src/positions.js - Zone Counts
mandir-crowd-monitor/backend/src/zones.js - Login & Tokens
mandir-crowd-monitor/backend/src/auth.js
Command Center
- Command Center Pages
trinetra-frontend/src/pages - App & Protected Routes
trinetra-frontend/src/App.jsx - Frontend Authentication
trinetra-frontend/src/context/AuthContext.jsx - Realtime Socket Context
trinetra-frontend/src/context/SocketContext.jsx
Field Hardware
- BLE SOS Band
band/ble_trilateration_network/network.cpp - LED Barricade
barricade/pico/main.py - Barricade Agent
barricade/agent.py
Other components
- Camera Feeds
- Control-Room Operator
- MongoDB
Connections 28
- Camera Feeds → CV Runner: provides video
- CV Runner → Zone Pipeline: starts zones
mandir-crowd-monitor/cv-engine/main.py - CV Runner → Annotated Feeds: serves feeds
mandir-crowd-monitor/cv-engine/main.py - CV Runner → Backend Signal Client: configures client
mandir-crowd-monitor/cv-engine/main.py - Zone Pipeline → Person Detector: runs tracking
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Zone Pipeline → Line Counter: counts crossings
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Zone Pipeline → Occupancy Counter: smooths counts
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Zone Pipeline → Backend Signal Client: posts events
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Zone Pipeline → Annotated Feeds: publishes frames
mandir-crowd-monitor/cv-engine/src/zone_pipeline.py - Backend Signal Client → API & Socket Server: posts events/counts
mandir-crowd-monitor/cv-engine/src/signal_client.py - API & Socket Server → Occupancy & Gate State: applies events
mandir-crowd-monitor/backend/server.js - API & Socket Server → Band Positions: updates positions
mandir-crowd-monitor/backend/server.js - API & Socket Server → Zone Counts: updates zone counts
mandir-crowd-monitor/backend/server.js - API & Socket Server → Login & Tokens: checks login
mandir-crowd-monitor/backend/server.js - Occupancy & Gate State → Gate Threshold Logic: computes gate state
mandir-crowd-monitor/backend/src/state.js - Occupancy & Gate State → State & Event Models: reads/writes records
mandir-crowd-monitor/backend/src/state.js - State & Event Models → MongoDB: persists state
- Control-Room Operator → App & Protected Routes: opens console
- App & Protected Routes → Frontend Authentication: provides session
trinetra-frontend/src/App.jsx - App & Protected Routes → Realtime Socket Context: provides realtime
trinetra-frontend/src/App.jsx - App & Protected Routes → Command Center Pages: routes pages
trinetra-frontend/src/App.jsx - Command Center Pages → API & Socket Server: uses REST and sockets
- Command Center Pages → Annotated Feeds: views MJPEG feeds
- Frontend Authentication → API & Socket Server: authenticates
trinetra-frontend/src/context/AuthContext.jsx - Realtime Socket Context → API & Socket Server: opens socket
- BLE SOS Band → API & Socket Server: posts SOS position
- API & Socket Server → Barricade Agent: supplies zone status
- Barricade Agent → LED Barricade: drives LEDs