How to find the next position of an object in an image based on the displacement of nearby objects?

3 次查看(过去 30 天)
I have 2 images, or let's say 2 frames( first one: reference image) obtained from a shaky video. The second frame is different from the first because of the vibration/shake. I want to find the pixel position of an object in the 2nd frame using the displacement/ distance between the pixels of other objects(like some markers) in these images.
What I did is I calculate the distance between the pixel positions of selected points in the 1st and 2nd images(same objects). But this distance are not the same and i cannot make an equation using this distance to find the (x2,y2) co-ordinates of the required object. How can I proceed further?
%%Input video file which needs to be stabilized.
filename = 'SS-75_zoom_Trim.mp4';
videoFReader = vision.VideoFileReader(filename, ...
'ImageColorSpace', 'RGB',...
'VideoOutputDataType', 'double');
%Create a video player object to play the video file
videoPlayer = vision.VideoPlayer;
img1=step(videoFReader); % obtain the first frame
img2=step(videoFReader); % second frame
figure;
imshow(img18);
[Ax,Ay] = getpts; %select points in image 1
figure;
imshow(img19);
[Bx,By] = getpts; %select the same point sin image 2
for i=1:3
dis(i) = hypot((Bx(i)-Ax(i)), (By(i)-Ay(i))); % calculate distance
end

回答(1 个)

Image Analyst
Image Analyst 2018-9-9
Try imregister() or imtranslate().

类别

Help CenterFile Exchange 中查找有关 Computer Vision Toolbox 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by