Displaying frames in a form of video on google colab

Viewed 1035

I am a trying video processing on google colab. My code read the video and break it into frames and after the processing on the frame I want to display the video as frames are processed. Like what cv2.imshow does (on local computer). But cv2.imshow gives error in colab so as it suggested I used cv2_imshow using from google.colab.patches import cv2_imshow . It is displaying the frames but in an column(like separate images) but replacing the previous displayed. Here is my colab link: https://colab.research.google.com/drive/1RUOGahcGngTWG9nBoisrsPzCLQ1Jq88v?usp=sharing You can see the output at the end of the page where multiple images are. Any help is really appreciated :)

1 Answers

try:

from google.colab.patches import cv2_imshow
from IPython.display import clear_output
from time import sleep

clear_output()
cv2_imshow(img)
sleep(0.1)

it's far from perfect (since there are some frame drops for some reason), but that's the closest thing I could find.

Related