Create_data_matrix_from_video lecture 3 Background Removal

Hello,

For those who would like to run the ‘create_data_matrix_from_video(clip, k=5, scale=50)’ since scipy.misc.imresize was removed from scipy, here is the updated function:

def create_data_matrix_from_video(clip, k=5, scale = (160,120)):
return np.vstack([np.array(Image.fromarray(rgb2gray(clip.get_frame(i/float(k))).astype(np.uint8)).resize(scale)).flatten()
for i in range(k * int(clip.duration))]).T

when calling the function for the scale parameter it will work with (80,60):

M = create_data_matrix_from_video(video,100, (80,60))

And if you havent found the video clip used in lecture 3, here it is: