基于姿态的灯光控制,使用Node-Red和带有AIkit的Raspberry Pi
介绍
本wiki将指导您如何使用AI kit运行YOLOv8,使用YOLOv8监控您的姿态,并最终根据您的姿态控制灯光。在这个项目中,USB摄像头捕获您的姿态,yolov8n在AI kit和reComputer R1000上运行以检测您的姿态。处理后的视频显示检测到的姿态,然后使用gstreamer实时流式传输到reTerminal DM。同时,关节坐标使用mqtt发送到部署在reComputer R1000上的Node-RED。最后,Node-RED流程根据关节坐标控制智能灯光。
准备硬件
运行此项目
在reComputer R1000上
步骤1:安装AI kit
请参考此wiki并确保您已将AI kit安装到您的reComputer R1000上。
步骤2:安装项目
使用以下命令下载项目:
git clone https://github.com/LJ-Hao/Pose-Based_Light_Control_with_Node-Red_and_Raspberry_Pi_with_AIkit.git && cd Pose-Based_Light_Control_with_Node-Red_and_Raspberry_Pi_with_AIkit
步骤 3:运行姿态估计
编辑 pose_estimation.py
文件,将 mqtt_server
更改为您的 reTerminal DM 的 IP 地址。并将 Gstreamer pipeline
更改为您的 reTerminal DM 的 IP 地址。然后运行以下命令开始姿态估计。
bash run.sh
Step 4: Install Node-RED
Install Node-RED. You can download Node-RED with just one line of command:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
步骤 5:导入 flows.json
导入项目文件。点击右上角的 设置 => 导入
,在新弹出的窗口中点击选择文件
进行导入,选择 flows.json
,最后点击导入
。
步骤 6:下载所需的控件
导入项目文件后,系统可能会提示您的 node-red 缺少一些控件。您需要下载以下控件:
@bartbutenaers/node-red-rtsp-to-mjpeg
@chirpstack/node-red-contrib-chirpstack
@flowfuse/node-red-dashboard
node-bacnet-contrib-extended
node-red-contrib-buffer-parser
node-red-contrib-image-output
node-red-contrib-image-tools
node-red-contrib-modbus
node-red-contrib-msg-speed
node-red-contrib-multipart-stream-encoder
node-red-contrib-onvif
node-red-contrib-play-audio
node-red-dashboard
node-red-node-base64
node-red-node-mysql
node-red-node-pi-gpio
node-red-node-ping
node-red-node-serialport
node-red-node-smooth
node-red-sensecap-paas
node-red-node-random
以 node-red-node-random
为例,点击右上角的 Settings => Manage Palette
,在新窗口中选择 Install
列,输入 node-red-node-random
,最后点击 Install
按钮。
步骤 7:部署项目
点击右上角的部署按钮,系统将正常运行。
在 reTerminal DM 上
步骤 1:在 reTerminal DM 上安装 gstreamer
使用以下命令下载 gstreamer:
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
Step 2: Install the repository
Download the repository with the command below:
git clone https://github.com/LJ-Hao/Pose-Based_Light_Control_with_Node-Red_and_Raspberry_Pi_with_AIkit.git && cd Pose-Based_Light_Control_with_Node-Red_and_Raspberry_Pi_with_AIkit
Step 3: Run video reciver
python3 video_receiver.py
结果
我们在 YouTube 直播中展示了这个演示,从 19:47
开始。您可以看到当主持人拍手时灯会亮起,然后当主持人挥手时灯会熄灭,请欣赏这个演示:
技术支持与产品讨论
感谢您选择我们的产品!我们在这里为您提供不同的支持,以确保您使用我们产品的体验尽可能顺畅。我们提供多种沟通渠道,以满足不同的偏好和需求。