Skip to content

Commit 7cbe393

Browse files
committed
UPdate README
1 parent 8313780 commit 7cbe393

1 file changed

Lines changed: 43 additions & 32 deletions

File tree

README.md

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,52 @@
1-
## 📸 Real-Time Camera Streaming with Object Detection
2-
A real-time camera streaming system built on a Raspberry Pi that integrates a custom Linux kernel module, a multithreaded user-space capture pipeline, MJPEG HTTP streaming, and optional on-device object detection using TensorFlow Lite.
1+
## 📸 Real-Time Embedded Linux Video Streaming System
2+
A real-time camera streaming system built on a Raspberry Pi that integrates a custom Linux kernel module, a multithreaded user-space capture pipeline, image processing, and MJPEG HTTP streaming.
33

44
This project demonstrates end-to-end system design across kernel space and user space. It combines Linux interfaces (V4L2, IOCTL, MMAP) with concurrent data pipelines and computer vision inference.
55

6-
💡 **Additional Notes**: Each key feature includes a link to **in-depth implementation notes** that describe how the module was designed and built.
7-
86
#### 🌿 Branches
97
- `main` - Stable, fully integrated version of the project
108
- `stream` - Core camera capture and MJPEG streaming pipeline
119
- `stream_detect` - Streaming pipeline with on-device object detection
1210
- `gh-pages` - Generated documentation hosted via github pages
13-
14-
📝 **Documentation**: The project includes **comprehensive Doxygen documentation** covering modules, functions, classes and detailed usage.
15-
11+
1612
👉 Explore the generated docs: [Doxygen Documentation](https://hajjsalad.github.io/RaspberryPi-Cam-Streamer/html/index.html)
1713
👉 Explore how the documentation was structured and written: [Notes on Notion](https://www.notion.so/hajjsalad/Doxygen-Documentation-2dea741b5aab809989afdaf9d198430b)
14+
👉 Each key feature includes a link to in-depth implementation notes that describe how the module was designed and built.
15+
16+
```This repository contains the backend implementation. The Android frontend is maintained in a separate repository: [Android Frontend repo](https://github.com/HajjSalad/RaspberryPi-Android-Video-Streaming)
17+
```
1818

19-
### 🗝️ Key Features
20-
1. **Custom Linux Kernel Module** [Notes on Notion](https://www.notion.so/hajjsalad/Cam-Stream-Kernel-Module-2cca741b5aab80e1bddbe204e5e99eae)
19+
#### System Components
20+
The backend is organized into five core components:
21+
- 🔌 **Kernel Device Driver** - Custom Linux character device driver (/dev/cam_stream) providing camera control and GPIO hardware abstraction via ioctl interface, with LED indicators for streaming state.
22+
- 📸 **V4L2 Camera Pipeline** - Low-level camera interfacing via Video4Linux2 API, handling device initialization, format negotiation (YUYV422 @ 640×480), MMAP buffer allocation, and continuous zero-copy frame capture.
23+
- 🔄 **Multithreaded Producer-Consumer Pipeline** - Producer thread captures and encodes frames into a mutex-protected circular buffer; consumer threads stream frames to connected clients. Semaphore-based synchronization ensures efficient frame handoff.
24+
- 🖼️ **Image Processing Pipeline** - Multi-stage processing: YUYV422 → RGB24 color space conversion (BT.601), motion detection via frame differencing (SAD), TensorFlow Lite object detection (MobileNet-SSD), and JPEG compression (libjpeg).
25+
- 📡 **MJPEG HTTP Streaming** - Lightweight TCP-based HTTP server bound to port 8080, handling client connections, routing requests via request manager, and delivering continuous MJPEG streams using multipart/x-mixed-replace protocol.
26+
27+
---
28+
### 🔌 Custom Linux Kernel Module
29+
[Notes on Notion](https://www.notion.so/hajjsalad/Cam-Stream-Kernel-Module-2cca741b5aab80e1bddbe204e5e99eae)
2130

2231
- Character device driver exposing camera control and LED status signaling via `ioctl`
2332
- Well-defined kernel ↔ user-space interface with minimal surface area
2433
- GPIO-driven LED indicators reflecting real-time camera streaming state
2534

2635
`GPIO` · `IOCTL` · `Character device` · `Linux kernel` · `kernel ↔ user space interface`
27-
28-
2. **V4L2-Based Camera Pipeline** [Notes on Notion](https://www.notion.so/hajjsalad/V4L2-Streaming-Pipeline-2cca741b5aab80be8b30e62d9311b929)
36+
---
37+
### 📸 V4L2-Based Camera Pipeline
38+
[Notes on Notion](https://www.notion.so/hajjsalad/V4L2-Streaming-Pipeline-2cca741b5aab80be8b30e62d9311b929)
2939

3040
- Camera configuration using V4L2 API, including format negotiation and stream parameters
3141
- Buffer allocation and zero-copy frame access via memory mapping I/O (MMAP)
3242
- Continuous frame capture with explicit buffer dequeue and re-queue operations
3343

3444
`V4L2` · `Camera drivers` · `MMAP` · `Buffer management` · `Video streaming`
35-
36-
3. **Multithreaded Producer-Consumer Architecture**
45+
---
46+
### 🔄 Multithreaded Producer-Consumer Architecture
3747
- Dedicated producer thread captures frames from the camera pipeline
3848
- Consumer thread streams encoded frames to connected HTTP clients
39-
- Lock-protected circular buffer ensure safe, low-latency data exchange between threads
40-
41-
`Mutex` · `Semaphore` · `Circular buffers` · `Multithreading` · `Producer-consumer model`
42-
43-
4. **MJPEG HTTP Streaming** [Notes on Notion](https://www.notion.so/hajjsalad/MJPEG-HTTP-Streaming-2cca741b5aab80d9ab6beddf8d86db00)
44-
45-
- Lightweight HTTP server for serving video streams
46-
- Multipart MJPEG streaming compatible with web browsers and MJPEG clients
47-
48-
`HTTP` · `MJPEG` · `Sockets` · `Lightweight server` · `Multipart streams`
49-
50-
5. **Real-Time Object Detection** [Notes on Notion](https://www.notion.so/hajjsalad/Object-Detection-2d2a741b5aab80ac958fc72ffb4de8a4)
51-
- Performs on-device inference using TensorFlow Lite on captured frames
52-
- Optimized for real-time edge deployment on the Raspberry Pi
53-
54-
`Edge AI` · `Object Detection` · `Embedded ML` · `TensorFlow Lite` · `Real-time Inference`.
55-
56-
---
57-
### 🧶 Threading Model
49+
- Lock-protected circular buffer ensure safe, low-latency data exchange between threads
5850
- Producer Thread
5951
- Continously capture frames from the camera using V4L2
6052
- Converts raw frames to JPEG and pushes them into a circular buffer
@@ -67,6 +59,25 @@ This project demonstrates end-to-end system design across kernel space and user
6759

6860
This design allows for **producer thread** to run continously, while a new **consumer thread** is spawned per client.
6961

62+
63+
`Mutex` · `Semaphore` · `Circular buffers` · `Multithreading` · `Producer-consumer model`
64+
---
65+
### 🖼️ Image Processing Pipeline
66+
[Notes on Notion](https://www.notion.so/hajjsalad/Object-Detection-2d2a741b5aab80ac958fc72ffb4de8a4)
67+
- Performs on-device inference using TensorFlow Lite on captured frames
68+
- Optimized for real-time edge deployment on the Raspberry Pi
69+
70+
`Edge AI` · `Object Detection` · `Embedded ML` · `TensorFlow Lite` · `Real-time Inference`.
71+
---
72+
### 📡 MJPEG HTTP Streaming**
73+
[Notes on Notion](https://www.notion.so/hajjsalad/MJPEG-HTTP-Streaming-2cca741b5aab80d9ab6beddf8d86db00)
74+
75+
- Lightweight HTTP server for serving video streams
76+
- Multipart MJPEG streaming compatible with web browsers and MJPEG clients
77+
78+
`HTTP` · `MJPEG` · `Sockets` · `Lightweight server` · `Multipart streams`
79+
80+
---
7081
### 🏗️ High Level Flow
7182
![Block Diagram](./Pi_cam_stream_Block_diagram.png)
7283

0 commit comments

Comments
 (0)