Code to extract images from a videos in matlab