In one of our previous examples, we used the video called
singleball.avi
, which is included in MATLAB as a demo. This video portrays a static box and a green ball that enters from the left of the frame and passes underneath the box to exit from the right part of the frame. Of course, without inspecting the video, we have no idea when the ball enters our frame. It could be at the beginning of the video, or maybe we would have to wait a while until we see it. So let's inspect all the frames to get a better idea:
First off, we load the video using VideoReader:
>> vObj = VideoReader('singleball.avi'); >> video = read(vObj); % read in all frames from video object
Now, we have our video stored in a four-dimensional matrix. This is enough for
montage
to take over:>> montage(video,'Size',[5 9]) % Using a 5x9 grid for 45 frames
The result of the preceding steps is as follows: