Can anyone help me to debug this error
Show older comments
V = 'army.avi';
xy1oObj = VideoReader (V); %Using video reader reading video
% Extracting frames
T = xyloObj.NumberOfframes % Calculate number of frames
for g = 1: T
p = read(xyloObj, g); %retrieve data from video
if (g ~=xyloObj.NumberOfFrames)
J = read (xyloObj, g + 1);
th = difference (p,J); %calculate histogram diff btwn two frames
X(g) =th;
end
end
% caculating mean and sd nd extracting frames
mean = mean2 (X)
std = std2 (X)
threshold = std + mean * 4
for g = 1: T
p = read (xyloObj, g);
if (g ~= xyloObj.NumberOfFrames)
J = read (xyloObj, g + 1);
th = difference (p,j);
if (th> mean) %greater than threshold select key frame
filename = fullfile ('C: \ Keyframes', sprintf ('frame_% frame20.JPG', g)); %writing keyframes
imwrite (J, filename);
end
end
end
function[ r ] = difference (f1,f2)
k = rgb2gray (f1);%convert into grayscale
l = rgb2gray (f2);
f11 = imhist (k); %histogram of data
f12 = imhiist (l);
diffe = imabsdiff (f11, f12); %absolute different of two images
r = sum(diffe);
end
error is:
Error: File: differ.m Line: 28 Column: 1
Function definitions are not permitted in this context.
Undefined variable "xyloObj" or function "xyloObj.NumberOfframes".
Error in differ (line 4)
T = xyloObj.NumberOfframes % Calculate number of frames
2 Comments
Stephen23
on 9 May 2018
@Sangeetha Srinivas: what MATLAB version are you using?
Sangeetha Srinivas
on 9 May 2018
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic 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!