简体   繁体   中英

streaming video from camera using pyqt4

I am using a thirdparty library that utilizes a circular buffer for image data and video. It has a method for getting the last image or popping it. I was wondering what would be the best way to implement video functionality in pyqt for this. Is there some video widget with a callback function that I could use? Or do I have to somehow implement parallel processing on my own? Parallel to this, suggestions on how this would be implemented in qt if you dont know how to implement it in pyqt would also be very much appreciated.

Thanks in advance!

I would pop the last image (from the circular buffer) and load it into a QPixmap . This allows you to put the image into a form that a pyqt4 gui would be able to load.

Depending on your libraries image format (straight forward bmp? jpg? png? raw pixels?), you can load the data into the QPixmap in one of two ways.

First: do it pixel by pixel (set the width and height of the image and copy each pixels value over one by one). This method is slow and I'd only resort to it if necessary.

Second: if the image is being stored in a common format (ones that are 'supported' are listed here ), this becomes trivial.

Then after the image is loaded in the QPixmap, I would use QLabel.setPixmap() to display the image.

Do this with a QTimer slot at a certain rate and you'll be able to display your images in a pyqt4 gui.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM