# Python 应用程序

Source: [https://docs.qualcomm.com/doc/80-70018-50SC/topic/python-sample-applications.html](https://docs.qualcomm.com/doc/80-70018-50SC/topic/python-sample-applications.html)

Qualcomm Linux 通过 [gstreamer1.0-python](https://git.codelinaro.org/clo/le/meta-qti-gst/-/blob/imsdk.lnx.2.0.0.r2-rel/recipes-gst/packagegroups/packagegroup-qcom-gst.bb?ref_type=heads#L45) 软件包提供了对 Python 的集成支持。Qualcomm IM SDK 支持 Python 绑定，可以在 Python 中创建基于 GStreamer 的应用程序。所有 GST 插件的 Python 绑定均通过 `gst-python` 实用工具启用。

使用 Python 运行自定义用例，以使用Qualcomm Linux 的多媒体和 AI/ML 功能。
Note: 作为参考，本指南提供了以下带有 Python 绑定的基于 Python 的示例应用程序。在运行这些应用程序之前，请完成[前提条件](https://docs.qualcomm.com/doc/80-70018-50SC/topic/prerequisites-for-python-sample-applications.html)。

Table : Python 应用程序

| 应用程序 | CodeLinaro Git 源路径 | 演示 | QCS6490 | QCS8275 | QCS9075 |
| --- | --- | --- | --- | --- | --- |
| [摄像头编码](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-encode.html) | [gst-camera-encode.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-camera-encode.py?ref_type=heads) | 对单个摄像头流进行编码并 dump 输出。 | ✔ | ✖ | ✖ |
| [使用 OpenCV 进行摄像头流传输](https://docs.qualcomm.com/doc/80-70018-50SC/topic/gst-camera-opencv-resize-py.html) | [gst-camera-opencv-resize.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-camera-opencv-resize.py?ref_type=heads) | 使用 OpenCV API 应用颜色转换或重新调整摄像头帧大小。 | ✔ | ✔ | ✔ |
| [使用 OpenCV 进行视频转换](https://docs.qualcomm.com/doc/80-70018-50SC/topic/video-playback-using-opencv.html) | [gst-opencv-transform](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-opencv-transform.py?ref_type=heads) | 使用 OpenCV API 采集、转换和播放视频流 | ✔ | ✔ | ✔ |
| [使用 Python 的多摄像头流](https://docs.qualcomm.com/doc/80-70018-50SC/topic/multi-camera-streaming-python-sample-app.html) | [gst-multi-camera-example](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-multi-camera-stream-example.py?ref_type=heads) | 同时从两个摄像头传感器进行数据流传输。 | ✔ | ✖ | ✖ |
| [使用 Python 并发视频播放（视频墙）](https://docs.qualcomm.com/doc/80-70018-50SC/topic/video-wall-using-python.html) | [gst-concurrent-videoplay-composition.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-concurrent-videoplay-composition.py?ref_type=heads) | 支持同时播放视频并将其呈现在屏幕上。 | ✔ | ✔ | ✔ |
| [目标检测与显示](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-detection-display.html) | [gst-ai-object-detection.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-ai-object-detection.py) | 对来自摄像头或文件源的流进行目标检测，并将输出显示或保存至文件中。 | ✔ | ✖ | ✖ |
| [使用 RTSP 流进行解码和目标检测](https://docs.qualcomm.com/doc/80-70018-50SC/topic/rts-decode-ai-detection-yolo-v8-overlay-display.html) | [gst-rtspsrc-detection-display.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-rtspsrc-detection-display.py) | 使用来自 RTSP 流的输入进行目标检测和显示。 | ✔ | ✖ | ✖ |
| [使用 Python 解码 JPEG 图像](https://docs.qualcomm.com/doc/80-70018-50SC/topic/decode-jpeg-images-using-python.html) | [gst-jpg-image-decode.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-jpg-image-decode.py?ref_type=heads) | 解码多张 JPEG 图像并在屏幕上预览。 | ✔ | ✔ | ✔ |
| [目标检测和分类](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-ai-detection-overlay-composer-display.html) | [gst-camera-two-stream-detection-and-classification-side-by-side.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-camera-two-stream-detection-and-classification-side-by-side.py?ref_type=heads) | AI 叠加编辑器显示的场景中的目标检测和对象分类。 | ✔ | ✔ | ✔ |
| [转换和编码摄像头流](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-transform-downscale-and-rotate-encode.html) | [gst-camera-rotate-downscale-file.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-camera-rotate-downscale-file.py?ref_type=heads) | 旋转、缩小和编码摄像头流。 | ✔ | ✔ | ✔ |
| [摄像头编码、目标检测和显示](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-encode-file-detection-yolov8-overlay-display.html) | [gst-camera-two-stream-encode-file-detection-display.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-camera-two-stream-encode-file-detection-display.py?ref_type=heads) | 对摄像头流进行编码并将其保存至文件中。 | ✔ | ✔ | ✔ |
| [目标检测、分类和分割](https://docs.qualcomm.com/doc/80-70018-50SC/topic/object-detection-classification-and-segmentation-python-sample-app.html) | [gst-filesrc-2detection-classification-segmentation-side-by-side.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-filesrc-2detection-classification-segmentation-side-by-side.py?ref_type=heads) | 从摄像头流中的场景进行目标检测、对视频流中的场景进行分类以及视频的语义分割。 | ✔ | ✔ | ✔ |
| [使用 Python 进行并行推理](https://docs.qualcomm.com/doc/80-70018-50SC/topic/parallel-inference-using-python.html) | [gst-parallel-inference.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-parallel-inference.py?ref_type=heads) | 多个 AI/ML 模型（目标检测、分类、分割和姿态检测）在来自摄像头、文件源或 RTSP 的流上并行运行。 | ✔ | ✖ | ✔ |
| [使用 Python 进行菊花链检测和姿态检测](https://docs.qualcomm.com/doc/80-70018-50SC/topic/daisy-chain-detection-and-pose-detection-using-python.html) | [gst-ai-daisychain-detection-pose.py](https://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/gst-plugins-qti-oss/-/blob/imsdk.lnx.2.0.0.r2-rel/gst-python-examples/gst-daisychain-detection-pose.py?ref_type=heads) | 使用摄像头源、文件源或 RTSP 流执行级联目标检测和姿态检测。 | ✔ | ✔ | ✔ |

- **[前提条件](https://docs.qualcomm.com/doc/80-70018-50SC/topic/prerequisites-for-python-sample-applications.html)**  

在运行基于 Python 的示例应用程序之前，请完成这些前提条件。
- **[摄像头编码](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-encode.html)**  

**gst-camera-encode-example** 应用程序可以记录和编码单个摄像头流。
- **[使用 OpenCV 进行摄像头流传输](https://docs.qualcomm.com/doc/80-70018-50SC/topic/gst-camera-opencv-resize-py.html)**  

**gst-camera-opencv-resize.py** 应用程序使用 OpenCV API 从实时摄像头流中采集摄像头帧，然后应用颜色转换或调整帧大小。调整后的输出将显示在屏幕上。
- **[使用 OpenCV 进行视频转换](https://docs.qualcomm.com/doc/80-70018-50SC/topic/video-playback-using-opencv.html)**  

**gst-opencv-transform.py** 应用程序将采集并转换视频帧，然后在屏幕上显示视频。
- **[使用 Python 并发视频播放（视频墙）](https://docs.qualcomm.com/doc/80-70018-50SC/topic/video-wall-using-python.html)**  

此 **gst-concurrent-videoplay-composition.py** 应用程序支持 MP4 AVC（H.264）视频的并发视频播放，并在视频墙显示器上执行合成。
- **[使用 Python 的多摄像头流](https://docs.qualcomm.com/doc/80-70018-50SC/topic/multi-camera-streaming-python-sample-app.html)**  

**gst-multi-camera-example.py** 应用程序可以从两个摄像头传感器同时进行流传输。该应用程序将摄像头馈送的图像数据并排进行合成并显示在屏幕上，或将视频流编码并存储到文件中。
- **[目标检测与显示](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-detection-display.html)**  

**gst-ai-object-detection.py** 应用程序可以检测摄像头流或文件流中的对象并显示结果或将输出保存到文件中。
- **[使用 RTSP 流进行解码和目标检测](https://docs.qualcomm.com/doc/80-70018-50SC/topic/rts-decode-ai-detection-yolo-v8-overlay-display.html)**  

**gst-rtspsrc-detection-display.py** 脚本接收 RTSP 流作为源，对其进行解码，使用 [YOLOv8](https://github.com/ultralytics/ultralytics) LiteRT 模型从摄像头流中识别场景中的对象，并将边界框覆盖在检测到的对象上。结果显示在显示屏上。
- **[使用 Python 解码 JPEG 图像](https://docs.qualcomm.com/doc/80-70018-50SC/topic/decode-jpeg-images-using-python.html)**  

**gst-jpg-image-decode.py** 应用程序可以解码 JPEG 图像，并在屏幕上查看解码后的图像。
- **[目标检测和分类](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-ai-detection-overlay-composer-display.html)**  

**gst-camera-two-stream-detection-and-classification-side-by-side.py** 应用程序使用 YOLOv8 LiteRT 模型来检测和分类 AI Overlay Composer 显示的场景中的对象。
- **[转换和编码摄像头流](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-transform-downscale-and-rotate-encode.html)**  

**gst-camera-rotate-downscale-file.py** 应用程序可旋转、缩小摄像头流并对其进行编码。然后将转换后的数据流保存到文件中。
- **[摄像头编码、目标检测和显示](https://docs.qualcomm.com/doc/80-70018-50SC/topic/camera-encode-file-detection-yolov8-overlay-display.html)**  

**gst-camera-two-stream-encode-file-detection-display.py** 应用程序对摄像头流进行编码并将其保存到文件中。该应用程序使用 YOLOv8 LiteRT 模型从摄像头流中识别场景中的对象。应用程序将边界框覆盖在检测到的对象上并显示结果。
- **[目标检测、分类和分割](https://docs.qualcomm.com/doc/80-70018-50SC/topic/object-detection-classification-and-segmentation-python-sample-app.html)**  

**gst-filesrc-2detection-classification-segmentation-side-by-side.py** 脚本从摄像机流中的场景中识别对象，将边界框叠加在检测到的对象上，从视频流中对场景进行分类，并对视频进行语义分割。输出并排显示在屏幕上。
- **[使用 Python 进行并行推理](https://docs.qualcomm.com/doc/80-70018-50SC/topic/parallel-inference-using-python.html)**  

**gst-parallel-inference.py** 应用程序接收来自摄像头、文件或 RTSP 流的视频输入，并将其发送给 AI 模型执行四通道并行处理（分类、目标检测、姿态检测和分割）。输出显示为带有叠加 AI 模型的预览。
- **[使用 Python 进行菊花链检测和姿态检测](https://docs.qualcomm.com/doc/80-70018-50SC/topic/daisy-chain-detection-and-pose-detection-using-python.html)**  

**gst-ai-daisychain-detection-pose.py** 应用程序可以使用来自摄像头、文件源或 RTSP 流的输入执行级联目标检测和姿态检测。
- **[自定义 Python 示例应用程序](https://docs.qualcomm.com/doc/80-70018-50SC/topic/customize-a-python-sample-application.html)**  

用户可以使用此过程中的说明开发自定义示例应用程序。

Last Published: Nov 12, 2025

[Previous Topic
视频合成](https://docs.qualcomm.com/bundle/publicresource/80-70018-50SC/topics/gst-weston-composition-example.md) [Next Topic
前提条件](https://docs.qualcomm.com/bundle/publicresource/80-70018-50SC/topics/prerequisites-for-python-sample-applications.md)