I read video, do operation, then save. But why cant my video open? I am using windows 10.
import numpy as np
import cv2
vid = cv2.VideoCapture("./results/videos/0.avi")
out = cv2.VideoWriter("./results/videos/0_processed.avi", cv2.VideoWriter_fourcc(*'MJPG'), 10, (960,378))
while(vid.isOpened()):
ret, im = vid.read()
if(ret==False):
break
im = im.astype(np.float)
im_median = np.median(im)
im = im + (155-im_median)
im[im > 255] = 255
im = im.astype(np.uint8)
out.write(im)
# When everything done, release the capture
vid.release()
out.release()