I have a video that I am using background subtraction and motion segmentation on. The floor in the video is black, so when I get the silhouette the feet and parts of the legs are cut off. Is there a fix around this? This is what it looks like.
This is the background image. This is a piece of my code....
clear all
close all
clc
% Read the video in the video object Mov
MM = mmreader('kassie_test_video.wmv');
% Read in all video frames.
Mov = read(MM);
% Get the number of frames.
FrameNum = MM.NumberOfFrames;
% load 'object_data.mat'
BackgroundImage = (Mov(:,:,:,98)); % background image
% set the sampling rate as well as the threshold for binary image.
downSamplingRate = MM.FrameRate;
%%
index = 1;
clear IM
clear Images
sf=10;ef=sf+30;
for ii =sf:ef
% Extract next frame
Im = im2double(Mov(:,:,:,ii));
% Background subtraction
Ib = rgb2gray(abs(im2double((Mov(:,:,:,ii)))-im2double(BackgroundImage)));
% conversion to binary image.
Thresh = graythresh(Ib);
Ib = im2bw(Ib, Thresh);
se = strel('square',1);
Ib = imerode(Ib,se); % Erode the image
Ib = medfilt2(Ib); % median filtering
Ib = imfill(Ib,'holes'); % fill the holes in the image
imshow(Ib,[])
end