I am trying to grab frames from a webcam and then writing them in a video. It works and the video shows something but it is useless.
Here you can see an example of the videos I get:
THe script is quite big so I will try to pick the relevant pieces for this problem:
import cv
capture = cv.CaptureFromCAM(1) # from webcam
frame = cv.QueryFrame(capture)
newvideo = 'Videos/%d_%d_%d_%d_%d_%d.avi' % (localtime()[0],localtime()[1],localtime()[2],localtime()[3],localtime()[4],localtime()[5])
video = cv.CreateVideoWriter(newvideo, cv.CV_FOURCC('D','I','V','X'), 30, cv.GetSize(frame), 1)
while(1):
frame = cv.QueryFrame(capture)
cv.WriteFrame(video, frame)
key = cv.WaitKey( int((1/30.)*1000)+1 )