[PySide] QVideoFrame() not accepting a QImage even though the documentation has an example?

Donald Fry donbfry at gmail.com
Mon Dec 27 23:00:21 CET 2021


Hi, everyone.

I believe I have come across an issue in the documentation of the
QGraphicsVideoItem.

My current goal is to open a capture session using OpenCV and feed it into
a Qt GUI. The example at the bottom of the QGraphicsVideoItem documentation
shows that one could insert a QImage by using setVideoFrame. When
implementing this into my project I receive a TypeError stating that
QVideoFrame does not accept a QImage as an argument. I am using Python 3.10
and the latest version of PySide6.

I have seen that there are other ways to achieve this through means of
inserting the QImage into a QGraphicsPixMap or QLabel but this seems better
suited for single images. I am unsure of what the preferred method is for
video feeds. If the documentation is incorrect, and QGraphicsVideoItem
indeed can not accept a QImage on a frame by frame basis, what would be
another means of passing an OpenCV feed into a QGraphicsView? I was
informed via Qt Forum thread that using a C library function memcpy could
possibly work but this is an area I have not yet explored.

Here are some relevant links:
Qt Forum post -
https://forum.qt.io/topic/133052/qvideoframe-not-accepting-a-qimage-even-though-the-documentation-has-an-example
QGraphicsVideoItem documentation -
https://doc.qt.io/qtforpython/PySide6/QtMultimediaWidgets/QGraphicsVideoItem.html

Kind Regards,
Don
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20211227/5ce638dc/attachment.html>


More information about the PySide mailing list