how to calculate resultant motion vector
Show older comments
By using blockmatcher of matlab i been able to sketch out motion vectors for current frame by comparing it with reference frame. I want to found resultant motion vector for current frame but can't find any way to perform this is task. Your kind guidance is required. I am attaching my code as well and
clear all; clc; workspace;
img1 = im2double(rgb2gray(imread('D:\Mattiiiilab\bin\5269.jpg'))); img2= im2double(rgb2gray(imread('D:\Mattiiiilab\bin\5291.jpg')));
hbm = vision.BlockMatcher('ReferenceFrameSource',... 'Input port','BlockSize',[101 101]); hbm.OutputValue = 'Horizontal and vertical components in complex form'; hbm.SearchMethod= 'Three-step'; motion = step(hbm,img1,img2);
[X Y] = meshgrid(1:101:size(img1,2),1:101:size(img1,1)); imshow(img2); hold on; quiver(X(:),Y(:),real(motion(:)),imag(motion(:)),0); hold off;
I have attached an image showing motion vectors as well
Answers (0)
Categories
Find more on Simulink 3D Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!