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 CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by