Problem Getting Motion History Image
19 views (last 30 days)
Show older comments

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 Comments
Answers (0)
See Also
Categories
Find more on Basic Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!