{"id":29538770,"url":"https://github.com/iammi/handcap-edge","last_synced_at":"2025-07-17T05:16:00.806Z","repository":{"id":303811494,"uuid":"1016774710","full_name":"IamMI/handCap-edge","owner":"IamMI","description":"Embeded competition ---- Edge","archived":false,"fork":false,"pushed_at":"2025-07-09T14:01:52.000Z","size":13174,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-09T15:20:26.087Z","etag":null,"topics":["cpp","embedded-systems"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IamMI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-09T13:59:41.000Z","updated_at":"2025-07-09T14:03:03.000Z","dependencies_parsed_at":"2025-07-09T15:34:44.221Z","dependency_job_id":null,"html_url":"https://github.com/IamMI/handCap-edge","commit_stats":null,"previous_names":["iammi/handcap-edge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IamMI/handCap-edge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IamMI%2FhandCap-edge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IamMI%2FhandCap-edge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IamMI%2FhandCap-edge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IamMI%2FhandCap-edge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IamMI","download_url":"https://codeload.github.com/IamMI/handCap-edge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IamMI%2FhandCap-edge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265567449,"owners_count":23789484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","embedded-systems"],"created_at":"2025-07-17T05:15:34.498Z","updated_at":"2025-07-17T05:16:00.763Z","avatar_url":"https://github.com/IamMI.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📹 Embedded YOLO-Based RTMP Streaming System\nThis project is a lightweight real-time video stream detection and streaming system deployed on the Loongson embedded development board, featuring:\n- Capturing camera frames using V4L2 (MJPEG format)\n- Decoding to BGR images using OpenCV\n- Detecting human presence using YOLOv5\n- Triggering detection every few frames and sending alerts via HTTP POST upon detection\n- Encoding and streaming frames to RTMP server via FFmpeg\n\n\n## 🧩 System Architecture\n```text\n[Camera (/dev/video0)] --\u003e [V4L2 + OpenCV decoding] --\u003e [YOLOv5 detection thread]\n         |                                              |\n         |-----\u003e RTMP stream via FFmpeg ----------------|\n         |-----\u003e Alert system (curl POST JSON to server)|\n```\n## 🚀 Features\n- 🎥 **MJPEG camera** frame capture\n- 🤖 Lightweight **YOLOv5-based** human detection\n- 🌐 Send alert events to remote server using **curl**\n- 📡 Real-time streaming (RTMP via **FFmpeg** subprocess)\n- 🧵 **Multithreaded** architecture with **condition variable** synchronization\n- 🖥️ Compatible with embedded Linux (e.g., **Loongson** platform)\n\n## 📦 Build Dependencies\n- C++17 or later\n- OpenCV\n- FFmpeg (must be available via CLI)\n- libcurl\n- V4L2 (included in Linux kernel)\n\n## 🔧 Usage\n1. Prepare the camera device\nMake sure the device `/dev/video0` is accessible and supports MJPEG format.\n\n    \u003e If the device `/dev/video0` is not recognized after connecting the camera, it may be due to missing drivers in your board's Linux system. In that case, a kernel replacement might be necessary.\n\n2. Create your own server like aliyun, expose its IP and some ports and rewrite \n    ```C++\n    const std::string RTMP_LIVE = \"rtmp://Your server IP:Port1/stream1\";\n    ```\n    and \n    ```C++\n    const std::string alertUrl = \"http://Your server IP:Port2/alert\";\n    ```\n\n\n3. Compile the program (*adjust paths as needed*)\n    ```bash 复制 编辑\n    g++ -std=c++17 camera.cpp yolo.cpp \\\n        -I/home/loongson/ncnn/build/install/include/ncnn \\\n        -L/home/loongson/ncnn/build/install/lib \\\n        -L/usr/lib/loongarch64-linux-gnu \\\n        -lncnn -lopencv_core  \\\n        -lopencv_highgui -lopencv_videoio  \\\n        -lopencv_imgproc -lopencv_imgcodecs \\\n        -lavcodec -lavformat -lavutil -lswscale -fopenmp  \\\n        -march=loongarch64 \\\n        -lcurl -o camera\n    ```\n4. Run the program\n    ```bash 复制 编辑\n    ./camera\n    ```\n\n## ⚠️ Alert Mechanism\nWhen a person is detected (every 60 frames), the system sends an alert via the following HTTP interface:\n\n```http 复制 编辑\nPOST http://Your server IP:Port/alert\nContent-Type: application/json\n\n{\n  \"event\": \"person_detected\",\n  \"camera\": \"main_camera\"\n}\n```\n\n\n## 📁 Project Structure (Partial)\n```\n.\n├── camera.cpp        # Main program: video capture, multithreading, RTMP streaming\n├── yolo.hpp          # YOLO model interface definitions\n├── yolo.cpp          # YOLO model loading and inference implementation\n└── build/            # Build output directory (optional)\n\n```\n\n## 📌 TODO\n- [ ] Support multiple camera switching\n- [ ] Add image compression and encoding optimization\n- [ ] Accelerate YOLO inference with CUDA / NPU","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiammi%2Fhandcap-edge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiammi%2Fhandcap-edge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiammi%2Fhandcap-edge/lists"}