S
S
SunUp2020-07-06 12:38:26
Python
SunUp, 2020-07-06 12:38:26

How to pass video frame from OpenCV to Matplotlib?

There is an IP camera from which the RTSP stream is taken through the Python version of OpenCV:

camera = cv2.VideoCapture(rtsp_url)
ret, frame = camera.read()
cv2.imshow('frame', frame)

Further, this stream must be transferred frame by frame to the library for processing, for this, according to the documentation of the library, it is used.
img = matplotlib.image.imread(img_file)
Now, for this, an intermediate saving of the OpenCV temporary file to disk is used, followed by its reading by Matplotlib
status = cv2.imwrite('image.jpg', frame)
img_file = matplotlib.image.imread('image.jpg')

How can you pass a stream frame by frame for processing directly without saving it to disk?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-07-06
@SunUp

In frame - the data is already in the right form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question