For this example, we will use the shaky_car.avi
video file included in the Computer Vision System Toolbox of MATLAB. In the first frame, we will manually choose an area in which we will be looking for feature points. Then, we will try to track these feature points in the rest of the frames in the video. Finally, the coordinate differences between the points we track will be used for motion compensation. Let's start:
The first step will be, as always, to load our video:
>> videoObj = VideoReader('shaky_car.avi');
Now, we will read a frame:
>> frame = read(videoObj,1);
Next, we choose a rectangular area:
>> imshow(frame); >> ROI=round(getPosition(imrect))
We can also show our selected area of interest (we will use the preceding car):
>> im = insertShape(frame, 'Rectangle', ROI, 'Color', 'red'); >> figure; imshow(im);
It is the time to detect and show the feature points in the area...