Motion vector calculation

6 vues (au cours des 30 derniers jours)
Vignesh
Vignesh le 1 Avr 2012
Commenté : shriya patil le 1 Juil 2019
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 commentaire
shriya patil
shriya patil le 1 Juil 2019
isn't it taking too long time for execution process??

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by