{"repo":"loadstarCN/Picamera","free":true,"listed":false,"github":"https://github.com/loadstarCN/Picamera","clone":"git clone https://github.com/loadstarCN/Picamera.git","description":"基于树莓派的图传监控系统","language":"Python","stars":33,"topics":["opencv","raspberry-pi","socket","python"],"license":"GPL-3.0","category":"self-hosted-apps","readme_excerpt":"Picamera 基于树莓派和普通 Web 摄像头的 Python 图传监控系统，支持 OpenCV 运动检测和人脸识别。 系统架构 系统由三个部分组成： 组件 文件 运行位置 说明 ------ ------ ---------- ------ Socket 客户端 socket client.py 树莓派 通过 USB 摄像头采集图像，经 Socket 发送至服务器 TCP 服务器 server.py Linux 服务器 接收图像数据，经 OpenCV 检测后保存到磁盘并缓存至内存 HTTP 服务器 server.py （内嵌） Linux 服务器 提供标注图片、原始图片和检测结果 JSON 三个端点 检测模块 detector.py Linux 服务器 OpenCV 运动检测、人脸检测，可扩展物体识别和目标跟踪 检测功能 功能 方法 状态 ------ ------ ------ 运动检测 帧差法 ( cv2.absdiff ) + 轮廓检测 已实现 人脸检测 Haar 级联分类器 ( haarcascade frontalface default.xml ) 已实现 物体识别 MobileNet-SSD（预留接口） 待实现 目标跟踪 KCF/CSRT tracker（预留接口） 待实现 服务器采用 双通道 架构：同时保存原始图片和标注后图片，并生成结构化 JSON 检测结果。OpenCV 未安装时自动降级为无检测模式，服务器仍可正常运行。 HTTP 端点 路径 Content-Type 说明 ------ ------------- ------ GET /latest.jpg image/jpeg 标注后的图片（含检测框和标签） GET /raw.jpg image/jpeg 原始未标注图片 GET /detection.json application/json 检测结果（计数、各检测框坐标、置信度、处理耗时） 通信协议 客户端与服务器之间使用自定义二进制协议，通过 TCP 端口 10086 通信。 图片上传协议 - 服务器收到后保存至 upload/d {设备ID}.jpg ，随即进行 OpenCV 检测处理 - 服务器通过时间戳判断是否为最新图片，拒绝过时数据 - 每设备有独立写锁（ threading.Lock ），防止并发写入冲突 快速开始 环境要求 - Python 3.6+ - OpenCV（可选，未安装时检测功能自动禁用） 启动服务器 发送测试图片 浏览器查看 打开 test html.html 查看检测监控面板（含标注图片、检测统计、检测详情，每 2 秒自动刷新），或直接访问： 命令行帮助 项目结构 联系方式 - 文档：https://loadstarcn.github.io/Picamera/ - 邮箱：richard@olive-app.com","default_branch":null,"files":null,"tree":[],"storefront":"/r/loadstarCN","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/loadstarCN/Picamera/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}