def video_cv(video):
 import cv
 video = video[:, :, ::(-1)]
 image = cv.CreateImageHeader((video.shape[1], video.shape[0]), cv.IPL_DEPTH_8U, 3)
 cv.SetData(image, video.tostring(), ((video.dtype.itemsize * 3) * video.shape[1]))
 return image

def video_cv ( video ) : import cv video = video [ : , : , : : ( - 1 ) ] image = cv . CreateImageHeader ( ( video . shape [ 1 ] , video . shape [ 0 ] ) , cv . IPL_DEPTH_8U , 3 ) cv . SetData ( image , video . tostring ( ) , ( ( video . dtype . itemsize * 3 ) * video . shape [ 1 ] ) ) return image
converts video into a bgr format for opencv this is abstracted out to allow for experimentation args: video: a numpy array with 1 byte per pixel .