I've been trying to add a video making module to my program using opencv, but try as I might I can't get the video to show more than 1 frame. I got this example code while searching for answers (Creating a video using OpenCV 2.4.0 in python)
import cv2
from cv import *
img1 = cv2.imread('i001.png')
img2 = cv2.imread('i002.png')
img3 = cv2.imread('i003.png')
height , width , layers = img1.shape
video=cv2.VideoWriter('test.avi', CV_FOURCC('D', 'I', 'V', 'X'),1,(width,height))
video.write(img1)
video.write(img2)
video.write(img3)
cv2.destroyAllWindows()
video.release()
This creates a video that runs for 3 seconds, but shows only the first image for all 3 seconds. Is there a codec error or am I missing something?