I want to create a video that's the hue transformation and then convert it to a binary image using thresholding. I give an RGB video as input and want to write it's hue transformation. Can someone help me? This is the code I have written (process_img does the transformation).
cap = cv2.VideoCapture(file_path)
fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
out = cv2.VideoWriter(vid_out,fourcc, 30, (640,480))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
result = process_img(frame)
# write the flipped frame
out.write(result)
# frame = np.ndarray(frame)
cv2.imshow('frame',result)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
It works fine when it outputs the image in cv2.imshow()
but the video is working. Can someone help me with this?