Error in Motion History Image Execution Matlab
Mostra commenti meno recenti
Hello!!
I am facing issue while running code of MHI. I am using Matlab R2015a. When I execute it, I am getting error that
Cell contents reference from a non-cell array object.
frame1 = fg{1};
function MHI = MHI(fg)
% Initialize the output, MHI a.k.a. H(x,y,t,T)
MHI = fg;
% Define MHI parameter T
T = 15; % # of frames being considered; maximal value of MHI.
% Load the first frame
frame1 = fg{1};
% Get dimensions of the frames
[y_max x_max] = size(frame1);
% Compute H(x,y,1,T) (the first MHI)
MHI{1} = fg{1} .* T;
%Start global loop for each frame
for frameIndex = 2:length(fg)
%Load current frame from image cell
frame = fg{frameIndex};
%Begin looping through each point
for y = 1:y_max
for x = 1:x_max
if (frame(y,x) == 255)
MHI{frameIndex}(y,x) = T;
else
if (MHI{frameIndex-1}(y,x) > 1)
MHI{frameIndex}(y,x) = MHI{frameIndex-1}(y,x) - 1;
else
MHI{frameIndex}(y,x) = 0;
end
end
end
end
end
I have been struggling hard. Please help
Risposte (1)
Walter Roberson
il 4 Set 2015
0 voti
When you call MHI, you need to pass in to it a cell array that contains two dimensional numeric arrays. It appears to me the code expects the arrays to be in uint8 format.
Categorie
Scopri di più su Computer Vision Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!