For the videoGrabber... I have no idea how to speed it up. It would be interesting if it could modify the video instead of having to call imshow when doing some "real-time" image processing.
In the case of imshow, there's this code that is faster, but skips frames sometimes:
# https://stackoverflow.com/a/65518369
from IPython.display import clear_output, Image, display, HTML
import numpy as np
import cv2
display_handle = display(None, display_id=True)
try:
for frame in frames:
display_handle.update(Image(data=cv2.imencode('.jpeg', cv2.cvtColor(np.asarray(frame), cv2.COLOR_RGB2BGR))[1].tobytes()))
sleep(0.1)
except KeyboardInterrupt:
pass
finally:
clear_output()
So... food for thought!
For the videoGrabber... I have no idea how to speed it up. It would be interesting if it could modify the video instead of having to call imshow when doing some "real-time" image processing.
In the case of imshow, there's this code that is faster, but skips frames sometimes:
So... food for thought!