Motion vector calculation

9 ビュー (過去 30 日間)
Vignesh
Vignesh 2012 年 4 月 1 日
コメント済み: shriya patil 2019 年 7 月 1 日
I am doing a project in Image processing "Grouping similar images in a video using Motion vectors and segmentation". In that, a video is seperated into frames(334 frames), and all the frames are divided into 8 * 8 blocks. With Image analyst and Kye taylor`s help, i managed to divide all the frames into 8 * 8 blocks. Now, I need to calculate the motion vectors for each block using Block matching concept. I used the following code
R=10;N=8;
for x = 1:N:height-N
for y = 1:N:width-N
MAD_min = 256;
mvx = 0;
mvy = 0;
for k = -R:1:R
for l = -R:1:R
MAD = 0;
for u = x:x+N-1
for v = y:y+N-1
if ((u+k > 0)&&(u+k < height + 1)&&(v+l > 0)&&(v+l < width + 1))
MAD = MAD + abs(f1(u,v)-f2(u+k,v+l));
end
end
end
MAD = MAD/(N*N);
if (MAD<MAD_min)
MAD_min = MAD;
dy = k;
dx = l;
end
end
end
xblk = floor((x-1)/(N+1))+1;
yblk = floor((y-1)/(N+1))+1;
mvx(xblk,yblk) = dx;
mvy(xblk,yblk) = dy;
end
end
I referred it somewhere here.
f1- anchor frame, f2-target frame. I think the code is working and the motion vectors are found. But, I want to know how the motion vectors are calculated here. Can anybody give the description for this code?
  1 件のコメント
shriya patil
shriya patil 2019 年 7 月 1 日
isn't it taking too long time for execution process??

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by