clear all, clc;

%%
% Construct a multimedia reader object 
readerobj = mmreader('05100.avi');
 
% Read in all video frames.
vidFrames = read(readerobj);
 
% Get the number of frames.
numFrames = get(readerobj, 'numberOfFrames');
 
% Create a MATLAB movie struct from the video frames.
% k = 35;
for k = 1 : numFrames
      mov(k).cdata = vidFrames(:,:,:,k);  
     
      im(k).cdata = im2bw(mov(k).cdata);

      out(k).cdata = bwareaopen(im(k).cdata, 20, 4);
      
      cc = bwlabel(out(k).cdata, 4);
      icedata = regionprops(cc,'basic');
      ice_areas = [icedata.Area];
      floe(k) = max(ice_areas);
            
end




