# 摄像头检测显示

Source: [https://docs.qualcomm.com/doc/80-70015-50SC/topic/camera-detection-display.html](https://docs.qualcomm.com/doc/80-70015-50SC/topic/camera-detection-display.html)

**gst-camera-detect-display.py** 脚本使用 YOLO v8 TensorFlow Lite 模型来检测摄像头流中的目标对象，在识别到的目标对象周围绘制边框，然后显示结果。

**命令** `python3 /usr/bin/gst-camera-detect-display.py`

## 预期输出

文件路径在 Python 脚本中固定配置为： MODEL\_FILE = "/opt/data/YOLOv8-Detection-Quantized.tflite" LABELS\_FILE = "/opt/data/yolov5m.labels"

| **过程** | **说明** |
| --- | --- |
| **qtiqmmfsrc** | 采集视频流（源）并创建源的 2 个副本： <ol class="ol" id="camera-detection-display__ol_mtc_hdg_zcc"><br>                                        <li class="li"><strong class="ph b">qtimetamux</strong> 插件保留其中 1 个视频流。</li><br><br>                                        <li class="li">ML 推理 pipeline 处理另一个视频流。</li><br><br>                                    </ol> |
| **预处理** | **预处理** |
| **qtimlvconverter** | <ol class="ol" id="camera-detection-display__ol_myk_3dg_zcc"><br>                                        <li class="li">在其接收设备接插口上接收视频流。</li><br><br>                                        <li class="li">执行预处理：<ol class="ol" type="a" id="camera-detection-display__ol_anl_jdg_zcc"><br>                                                <li class="li">色彩转换。</li><br><br>                                                <li class="li">缩小/放大。</li><br><br>                                                <li class="li">在模型使用浮点值输入时，对流数据进行归一化。</li><br><br>                                            </ol><br></li><br><br>                                        <li class="li">在其源接插口上将视频流转换为张量数据。目标检测模型使用此张量数据进行推理。</li><br><br>                                    </ol> |
| **推理** | **推理** |
| **qtimltflite** | <ol class="ol" id="camera-detection-display__ol_v12_5dl_zcc"><br>                                        <li class="li">加载目标检测模型。</li><br><br>                                        <li class="li">为选择的 delegate 修改图形。</li><br><br>                                        <li class="li">在其接收设备接插口上接收张量数据。</li><br><br>                                        <li class="li">执行推理并在其源接插口上生成带有目标检测结果的张量数据。</li><br><br>                                    </ol> |
| **后处理** | **后处理** |
| **qtimlvdetection** | <ol class="ol" id="camera-detection-display__ol_khl_sdg_zcc"><br>                                        <li class="li">接收来自目标检测的推理张量。</li><br><br>                                        <li class="li">将接收设备接插口上的推理张量转换为视频或文本等格式，稍后可由多媒体插件进行处理。</li><br><br>                                        <li class="li">将阈值应用于所选的结果数。</li><br><br>                                        <li class="li">加载检测模型的相应模块。</li><br><br>                                        <li class="li">加载检测模型的相应模块。</li><br><br>                                    </ol><br><br>                                    <br>在此用例中，qtimlvdetection 执行以下操作：<ul class="ul" id="camera-detection-display__ul_e2z_vdg_zcc"><br>                                            <li class="li">加载 YOLO v8 子模块。</li><br><br>                                            <li class="li">将结果生成为文本结构。</li><br><br>                                            <li class="li">接着发送到 <strong class="ph b">qtimetamux</strong> 的接收设备接插口。</li><br><br>                                        </ul> |
| **qtimetamux** | <ol class="ol" id="camera-detection-display__ol_pt1_zdg_zcc"><br>                                        <li class="li">在接收设备接插口上接收视频流和文本流，以及与视频流相对应的边框结果。</li><br><br>                                        <li class="li">使用接收设备接插口中的视频流内容生成地面启动 (GST) 缓冲区。</li><br><br>                                        <li class="li">将边框作为 GstVideoRegionOfInterest 从数据接收设备接插口添加到其源接插口上的 GST 缓冲区元数据（元多路复用）。</li><br><br>                                    </ol> |
| **qtioverlay** | <ol class="ol" id="camera-detection-display__ol_bkj_c2g_zcc"><br>                                        <li class="li">接收多路复用流。</li><br><br>                                        <li class="li">使用 CL 将边框叠加在 VideoFrame 上。</li><br><br>                                        <li class="li">在其源接插口上生成带有叠加层的 GST 缓冲区</li><br><br>                                    </ol> |
| **输出** | **输出** |
| **waylandsink** | <ol class="ol" id="camera-detection-display__ol_x3m_22g_zcc"><br>                                        <li class="li">在其接收设备接插口上接收视频流。</li><br><br>                                        <li class="li">将视频流提交到 Weston。</li><br><br>                                        <li class="li">通过 Weston 在本地显示设备上渲染为该场景的目标对象生成的视频流和边框。</li><br><br>                                    </ol> |

**Parent Topic:** [摄像头应用示例](https://docs.qualcomm.com/doc/80-70015-50SC/topic/sample-applications-for-camera.html)

Last Published: Nov 11, 2025

[Previous Topic
摄像头编码](https://docs.qualcomm.com/bundle/publicresource/80-70015-50SC/topics/camera-encode.md) [Next Topic
摄像头检测编码](https://docs.qualcomm.com/bundle/publicresource/80-70015-50SC/topics/camera-detection-encode.md)