Problem Getting Motion History Image
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens

I have problem for my MHI image. It is fixed on a frame and it doesn't have the motion sequence. Can anyone tell me how to fix it?
clear all
Video1 = VideoReader('C:\Users\User\Desktop\FYP\database\tumiitgait database\uploaded_video\Normal Walk\normal_id001_1.avi');
ii = 1;
for i=1:227 % keyboard data(:,:,i)=mean(readFrame(Video1),3); end
% data = uint8(255 * data);
MHI = data;
% Define MHI parameter T
T = size(data,3)+20; % # of frames being considered; maximal value of MHI
% Load the first frame
frame1 = data(:,1);
% Compute H(x,y,1,T) (the first MHI)
fst = MHI(:,1);
fst(fst>0) = T;
MHI(:,1) = fst;
% start global loop for each frame
for frameIndex = 2 : size(data,3)
%fprintf('Loading frame Index %d\n',frameIndex);
% Load current frame from image array
frame = data(:,frameIndex);
frame_pre = MHI(:,frameIndex-1);
MHI(:,frameIndex) = frame_pre - 1;
% Set of all non-zero value to T
frame(frame > 0) = T;
[y,x] = find(frame > 1);
for i = 1 : size(y,1)
MHI(y(i,:), x(i,:), frameIndex) = frame(y(i,:), x(i,:));
end
end
figure, imshow(MHI(:,:,227),[])
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Basic Display 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!