PyQtGraph: Live video stream freezes using ImageView -
PyQtGraph: Live video stream freezes using ImageView -
hi everyone,
i'm writing gui photographic camera , i'd have widget live stream camera.
following 1 of examples, i'm doing way:
def updateview(): global img, photographic camera img.setimage(camera.most_recent_image(camera.detector_shape)) win = qtgui.qwidget() # image widget imagewidget = pg.graphicslayoutwidget() view = imagewidget.addviewbox() view.setaspectlocked(true) img = pg.imageitem(border='w') view.additem(img) view.setrange(qtcore.qrectf(0, 0, 512, 512)) layout = qtgui.qgridlayout() win.setlayout(layout) layout.addwidget(imagewidget, 1, 2, 3, 1) win.show() viewtimer = qtcore.qtimer() viewtimer.timeout.connect(updateview) viewtimer.start(0) app.exec_() viewtimer.stop() this indeed works , happy if wasn't fact need intensity histogram on side.
so tried changing first paragraphs this:
def updateview(): global img, photographic camera img.setimage(camera.most_recent_image(camera.detector_shape), autohistogramrange=false) win = qtgui.qwidget() img = pg.imageview() layout = qtgui.qgridlayout() win.setlayout(layout) layout.addwidget(img, 1, 2, 3, 1) this works few frames (i can see images changing , histogram moving accordingly) , whole gui freezes. has seen behaviour?
thanks in advanced,
federico
first: possible utilize histogram / contrast controls without imageview. see: https://github.com/pyqtgraph/pyqtgraph/blob/develop/examples/imageanalysis.py
regarding freezing: if run code generating random info rather pulling camera, runs fine. suspect problem lies elsewhere. perhaps using multiple threads incorrectly? may need post more finish example, , testing determine programme hanging up.
pyqtgraph
Comments
Post a Comment