filename = 'shaky_car.avi';
videoFReader = vision.VideoFileReader(filename, ...
'ImageColorSpace', 'Intensity',...
'VideoOutputDataType', 'double');
videoPlayer = vision.VideoPlayer;
while ~isDone(videoFReader)
frame = videoFReader();
videoPlayer(frame);
pause(0.01);
end
imgA = step(videoFReader);
imgB = step(videoFReader);
ax1 = subplot(1,2,1);
imshow(imgA);
ax2 = subplot(1,2,2);
imshow(imgB);
objectRegionA = round(wait(imrect(ax1)));
objectRegionB = round(wait(imrect(ax2)));
objectImageA = insertShape(imgA,'Rectangle',objectRegionA,'Color','red');
objectImageB = insertShape(imgB,'Rectangle',objectRegionB,'Color','red');
figure;
imshowpair(objectImageA, objectImageB ,'montage');
title('Red box shows object region');
pointsA = detectMinEigenFeatures(imgA,'ROI',objectRegionA);
pointsB = detectMinEigenFeatures(imgB,'ROI',objectRegionB);
pointImageA = insertMarker(imgA,pointsA.Location,'+','Color','white');
pointImageB = insertMarker(imgB,pointsB.Location,'+','Color','white');
figure;
imshowpair(pointImageA,pointImageB,'montage');
title('Detected interest points');
release(videoFReader);
release(videoPlayer);
Best Answer