Hello.
I want to convert video to binary image.
And then I want to find center and crop image.
Binay image cropped image
I want to use several images in a folder using for loop. Could I get an idea about this?
Basiclly, I will use this code to convert video to images.
clear allclose all%// read the video:
reader = VideoReader('shahar_bend.avi');vid = {};while hasFrame(reader) vid{end+1} = im2single(readFrame(reader));end%// simple background estimation using mean:
bg = mean( cat(4, vid{:}), 4);%// estimate foreground as deviation from estimated background:
for i=1:40 fIdx(i) = i; %// do it for frame 1 ~ 60
fg{i} = sum( abs( vid{fIdx(i)} - bg ), 3 ); fg{i} = imresize(fg{i}, 0.3); fg{i} = reshape(fg{i},[],1);endX = cell2mat(fg);data = double(X);
Best Answer