How to arrange vector array
Afficher commentaires plus anciens
Hi,
I have a problem with this coding.
imgreference=imread('C:\Users\Acer\Documents\MATLAB\Flow\Flow1.jpg');
% Read frames
text='C:\Users\Acer\Documents\MATLAB\Flow\Flow';
fr = [];
tt = [];
mm = [];
for im=18:20;
filname=strcat(text,int2str(im));
filname=strcat(filname,'.jpg');
img=imread(filname);
[fx,fy,ft,vAvg,uAvg,u,v]=HS(img,imgreference);
U= u.^2;
V=v.^2;
velocity =sqrt(U+V);
fr = [velocity; fr];
b = reshape(fr,360,480,[]);
OpticalFlow = [u;v];
tt = [OpticalFlow; tt];
O = reshape(tt,360,480,[]);
SpatiotemporalAverageOF = [uAvg;vAvg];
mm = [SpatiotemporalAverageOF; mm];
Oave = reshape(mm,360,480,[]);
end
Question;
How to arrange OpticalFlow= [u;v] so that it forms 360x480x3 instead of 360x480x6.
for b = reshape(fr,360,480,[]) i got 360x480x3.
I want both of these values are same to do further mathematical operations.
Thanks friend!
Réponses (1)
Walter Roberson
le 15 Jan 2014
0 votes
You cannot. If it is coming out as 360 x 480 x 6 then it has twice as much data as would be used for 360 x 480 x 3.
MATLAB does not have HS() in any toolbox, so I cannot analyze to see why u and v are coming out 360 x 240 x 6.
If you are using HS from http://www.mathworks.com/matlabcentral/fileexchange/22756-horn-schunck-optical-flow-method then that routine only returns two values, u and v, not the 7 that you show being returned.
1 commentaire
Nur
le 15 Jan 2014
Catégories
En savoir plus sur Motion Estimation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!