Skip to main content
jumman_JHINGA
Senior III
July 9, 2026
Question

STM32MP2 + Qt6 + X-LINUX-AI: need help for custom AI object detection application

  • July 9, 2026
  • 0 replies
  • 16 views

Hi ST Community,

I'm developing a custom AI application on the STM32MP257F-DK using the following software stack:

Software Environment

  • Board: STM32MP257F-DK
  • Starter Package: OpenSTLinux 6.6
  • X-LINUX-AI Expansion Package: v6.0
  • X-LINUX-QT: v2.1
  • SDK: STM32MP2 SDK (cross-compilation on Ubuntu)
  • Qt: Qt 6.6 (cross compiled)
  • Language: C++
  • IDE: Qt Creator
 

Application Goal

I want to develop my own Qt Quick application (not modify the Python demo) with the following architecture:

USB Camera


Camera Capture


AI Inference (ST AI Runtime / NPU)


Bounding Boxes


Qt Quick GUI

The objective is to build a modular C++ application that can later be extended with multiple AI models.

 

What I have already verified

The Logitech C270 webcam is correctly detected.

/dev/video7

v4l2-ctl --all reports:

  • Resolution: 640x480
  • Format: YUYV
  • 30 FPS

I can also run:

gst-launch-1.0 v4l2src device=/dev/video7 ! videoconvert ! autovideosink

and the pipeline reaches the PLAYING state.

 

What I discovered

Initially I implemented camera capture using:

cv::VideoCapture("/dev/video7")

and also

cv::VideoCapture(..., cv::CAP_GSTREAMER)

However, read() always fails and the camera cannot be used reliably.

While inspecting the official X-LINUX-AI demo, I noticed that ST does not use cv::VideoCapture.

The official Python implementation builds a native GStreamer pipeline:

v4l2src

capsfilter

videoconvert

videoscale

appsink

Frames are then extracted from appsink and converted into a NumPy array before being passed to the AI runtime.

This suggests that ST recommends using native GStreamer instead of OpenCV VideoCapture on STM32MP2.

 

My Questions

1. For a new C++ Qt application, what is the recommended camera acquisition method?

Should we:

  • use OpenCV VideoCapture, or
  • use a native GStreamer pipeline with appsink, similar to the official Python demo?
 

2. Is there an official C++ example that demonstrates:

 

  • GStreamer camera capture
  • ST AI Runtime integration
  • Qt GUI

instead of the Python/GTK implementation?

 

3. What is the recommended architecture for a production application?

 

For example:

Camera Thread


Frame Queue


AI Thread


Qt GUI Thread

or is there another architecture recommended by ST?

 

4. Is there any ST-supported C++ wrapper around the X-LINUX-AI runtime that can replace the Python implementation?

 

 

5. Would ST recommend reusing the GStreamer pipeline from the Python demo inside a Qt application, or is there another preferred multimedia framework for custom applications?

 

 

End Goal

The final application should provide:

  • Live USB camera preview
  • NPU-accelerated object detection
  • Bounding box overlay
  • Multiple AI models
  • Fully custom Qt Quick interface
  • C++ implementation only

I would appreciate any recommendations, architecture diagrams, official examples, or best practices for building such an application on the STM32MP257 platform.

Thank you.