Problem Getting Motion History Image

19 ビュー (過去 30 日間)
Kang Yee Tan
Kang Yee Tan 2017 年 1 月 26 日
編集済み: Kang Yee Tan 2017 年 1 月 27 日
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by