Skip to content

Try to speed up videoGrabber and imshow #2

Description

@ricardodeazambuja

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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions