I used this example to record a video, but there is no output. Any help, please:
import cv2
if __ name __ == " __ main __ ":
# find the webcam
capture = cv2.VideoCapture(0)
# video recorder
fourcc = cv2.cv.CV_FOURCC(*'XVID') # cv2.VideoWriter_fourcc() does not exist
videoOut = cv2.VideoWriter("output.avi", fourcc, 20.0, (640, 480))
# record video
while (capture.isOpened()):
ret, frame = capture.read()
if ret:
videoOut.write(frame)
cv2.imshow('Video Stream', frame)
else:
break
# Tiny Pause
key = cv2.waitKey(1)
capture.release()
videoOut.release()
cv2.destroyAllWindows()
I got this error:
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
(Video Stream:2758): Gtk-WARNING **: cannot open display: