How to display a videostream in the PyQt GUI by a efficient way

kivilaya kivilaya at 163.com
Mon Oct 1 22:31:56 EDT 2007


Hi, David! ^__^

  Your advice makes me know the important thing of my question is the
way I get the source video.

  I do this on the Windows XP operating system, and make these changes
on a live video stream. And I think you are right, the conversion
process takes most part of the time, and the raw data from the camera
is being converted more than twice before it reaches the screen (It is
all because of my lack of the knowledge of  how to using
loadFromData()).
  After I get a PIL image named im from the camera, I convert it like
this,
        s = StringIO()
        self.im.save(s, "PNG")
        s.seek(0)
        image = QImage()
        image.loadFromData(s.read())
        img = QPixmap.fromImage(image)
        s.close()

  I'm not familiar with the way of getting the data from the camera,
so in my current way, I just use a function in the videocapture module
that can save the current picture in of the camera to get the data,
and do this 15 times every minute to make the source data as a live
video stream.
  So I think learn the use of QPixmap.loadFromData() and the use of
videocapture module is important for me.

  Thank you for your help, your suggestion let me get more and more
familiar with the things I do and learn a lot.:)

Kivilaya







More information about the Python-list mailing list