Skip to content
Advertisement

Tag: opencv

cv2.imwrite doesn’t save result image but initial only

I have a code: that generates grid like this one: So cv2.imshow shows the grid but cv2.imwrite writes only initial black background not the grid for some reason. How to fix that? Answer You need to scale the color channels: cv2.imwrite(“background.jpg”, background) Alternatively you can create a “white” image with type uint8: img = numpy.ones((255, 465, 3))

cv2 creates a unreadable .mp4v (and .avi) file

I’m trying to create a simple screen recorder with Python. This is the code It doesn’t give any error while it’s going, and it creates a .mp4v file correctly, however when I try to watch the video that was supposed to be recorded, it can’t be opened. I tried with VLC and other apps but it’s unsupported everywhere. Can someone

Pass video uploaded via django to cv2

I am uploading video via django and want to process it using cv2. This is how video uploaded via django is accessed. Next i want to pass it to opencv. I dont want to save video in disk first and then acess it via cv2 using following code I tried passing this video_obj to VideoCapture this way But i got

Advertisement