Upload image as np array to FIrebase storage

I’m trying to upload an image to the Firebase storage.
I have no problems doing that when uploading a local image, with:


However, in my case the image is a frame from a remote camera, retrieved by using OpenCV, so that I have it as a np.array. I tried using it as in the previous example, but it doesn’t work.

cap = cv2.VideoCapture(remote_camera_address)
ret, frame = cap.read() -> frame is a np array

This is returning the error:

raise ValueError('total bytes could not be determined. Please '
ValueError: total bytes could not be determined. Please pass an explicit size.

Clearly, I could save the np array to a local image, upload that image and delete it afterwards, but I was wondering if I could do it in a cleaner way.

Source: Python Questions