Changed how image is created before updating the Image Element. Now is 1 line of code.
This commit is contained in:
parent
474917b50b
commit
462a4f4385
|
@ -57,10 +57,16 @@ def main():
|
||||||
slider_elem.Update(cur_frame)
|
slider_elem.Update(cur_frame)
|
||||||
cur_frame += 1
|
cur_frame += 1
|
||||||
|
|
||||||
|
imgbytes = cv.imencode('.png', frame)[1].tobytes() # ditto
|
||||||
|
image_elem.Update(data=imgbytes)
|
||||||
|
|
||||||
|
"""
|
||||||
|
# This was another way updates were being done, but seems slower than the above
|
||||||
img = Image.fromarray(frame) # create PIL image from frame
|
img = Image.fromarray(frame) # create PIL image from frame
|
||||||
bio = io.BytesIO() # a binary memory resident stream
|
bio = io.BytesIO() # a binary memory resident stream
|
||||||
img.save(bio, format= 'PNG') # save image as png to it
|
img.save(bio, format= 'PNG') # save image as png to it
|
||||||
imgbytes = bio.getvalue() # this can be used by OpenCV hopefully
|
imgbytes = bio.getvalue() # this can be used by OpenCV hopefully
|
||||||
image_elem.Update(data=imgbytes)
|
image_elem.Update(data=imgbytes)
|
||||||
|
"""
|
||||||
|
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue