Created
September 26, 2025 04:52
-
-
Save imneonizer/c06e4ec89ea76001f496c09acc4dfe5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| import av | |
| import numpy as np | |
| from IPython.display import display, clear_output, Image as DispImage | |
| def imshow(frame): | |
| """ | |
| Display a frame inline in Jupyter; each call replaces the previous one. | |
| No matplotlib, no ipywidgets required. | |
| """ | |
| ok, jpeg = cv2.imencode('.jpg', frame) | |
| if not ok: | |
| return | |
| clear_output(wait=True) | |
| display(DispImage(data=jpeg.tobytes())) | |
| container = av.open("rtsp://localhost:8554/home_camera") | |
| for frame in container.decode(video=0): | |
| img = frame.to_ndarray(format="bgr24") | |
| imshow(img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment