frames = {avi.cdata}; %uses the cdata from the video file
fg = extractForeground(frames); % do foreground extraction
cmap = colormap(gray);
for i = 1:length(fg)
temp0{i} = edge(fg{i}, 'canny', 0.99) + fg{i};
temp2 = temp0{i};
temp2 = cat(3,temp2,temp2,temp2);
fgs = rgb2gray(temp2);
sedisk = strel('square',10);
fgs = imclose(fgs, sedisk);
fgs = imfill(fgs,'holes');
RLL = bwlabel(fgs);
stats = regionprops(RLL,'basic','Centroid');
fig = figure(1),imshow(RLL)
hold on
for n = 1:length(stats)
if(stats(n).Area > 100)
plot(stats(n).Centroid(1), stats(n).Centroid(2),'r*')
end
end
hold off
end;
clear all;
frames = {avi.cdata}.it post this message after i enter the command.Undefined variable "avi" or class "avi.cdata". what does it imply?thank you..
ReplyDeleteit means u did not set the variable "avi", you need to do something like
ReplyDeleteavi = aviread('somevideo.avi');
frames = avi.cdata;
Sorry for late.I have try this
ReplyDelete>> avi = aviread('somevideo.avi');
and it show this:
??? Error using ==> readavi
Error getting frame data.
Error in ==> aviread at 64
X = readavi(info.Filename,-1);
What wrong with the command? After I tried this and it works,
>> avi = aviread('somevideo.avi',1);
Is there any significant between those two command? Thank you.
by the way..i can use the extractForeground.m i get from matlab.It got error stated;
ReplyDelete??? Error using ==> subsref
Index exceeds matrix dimensions.
Error in ==> extractForeground>pctile at 261
pct = subsref(sx,ref);
Error in ==> extractForeground at 98
backgroundDeviation(:,:,1) =
max(backgroundDeviation(:,:,1),pctile(nonzeros(backgroundDeviation(:,:,1)),minSigmaLevel));
Error in ==> blob_morphological at 14
fg = extractForeground(frames); %foreground extraction
Do you know what can i do to solve it and why it happen?
Thank you again.
do you hav any idea about oil leakage detection using matlab if so mail me @ sujith.oilleakage@gmail.com
ReplyDelete