I am trying to draw multiple ROI's in " different images ImgA & ImgB (which are the first 2 frames of a video). But, when I draw one ROI in imgA , it jumps to the step of identifying the salientpoints in the ROI and automatically the same ROI is displayed for imgB.
What change should I make here?
%%Load a video and draw ROI in the video/image frames
%%Input video file which needs to be stabilized.
filename = 'shaky_car.avi';%Load the video using a video reader object.
videoFReader = vision.VideoFileReader(filename, ... 'ImageColorSpace', 'Intensity',... 'VideoOutputDataType', 'double');%Create a video player object to play the video file
videoPlayer = vision.VideoPlayer;while ~isDone(videoFReader) frame = videoFReader(); videoPlayer(frame); pause(0.01);endimgA = step(videoFReader);imgB = step(videoFReader);imshowpair(imgA,imgB,'montage');objectRegion = round(getPosition(imrect));objectImageA = insertShape(imgA,'Rectangle',objectRegion,'Color','red');objectImageB = insertShape(imgB,'Rectangle',objectRegion,'Color','red');figure;imshowpair(objectImageA, objectImageB ,'montage');title('Red box shows object region');%Detect interest points in the object region.
pointsA = detectMinEigenFeatures(imgA,'ROI',objectRegion);pointsB = detectMinEigenFeatures(imgB,'ROI',objectRegion);%Display the detected points.
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