フィルターのクリア

PLease help me with filling the gape after doing simple subtraction of these images

3 ビュー (過去 30 日間)
BlueBee77
BlueBee77 2016 年 7 月 2 日
編集済み: BlueBee77 2016 年 7 月 3 日
I am trying to do background subtraction,by simply subtracting two image. However the resultant image has some gape. Can anyone help me solve this. I would appreciate if someone can help. Attached are the images

回答 (2 件)

Image Analyst
Image Analyst 2016 年 7 月 2 日
You need to lower your threshold if you want to capture the man's tan coat over a tan walkway. Or else look at optical flow.
  9 件のコメント
Image Analyst
Image Analyst 2016 年 7 月 2 日
I'm surprised a low threshold with optical flow didn't work, or that Guassian mixed models or simple subtraction didn't work. But you promised you tried all those methods plus more and they all failed.
So you'll have to scout out the literature. Start here http://www.visionbib.com/bibliography/contents.html to look for possible other methods not covered by the Computer Vision System Toolbox.
BlueBee77
BlueBee77 2016 年 7 月 3 日
Thanks for sharing. I will go through these.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2016 年 7 月 2 日
FirstImage = imread('BackgroundInt.png');
SecondImage = imread('BackInt4.png');
diff_image = double(SecondImage) - double(FirstImage);
sdiff_image = diff_image - min(diff_image(:));
sdiff_image = sdiff_image ./ max(sdiff_image(:));
pixels_changed = double( any(diff_image ~= 0, 3) );
image(sdiff_image, 'AlphaData', pixels_changed);
set(gca, 'color', [0 .5 0])
The green parts that show up will be the pixels with no change. You will see a lot of gray areas: those are areas where at least one of the pixel components changed a little. The person will have clearer outlines, including blue pants.
In order to get any further you would need to use a threshold to define changes as being too small to be meaningful. For example you could substitute
pixels_changed = double( any(abs(diff_image) >5, 3) );
Also, you can do
mask = repmat(logical(pixels_changed), 1, 1, 3);
FIm = FirstImage * 0; %same size and datatype
FIm(mask) = FirstImage(mask);
subplot(1,2,1);
image(FIm);
axis image
SIm = SecondImage * 0; %same size and datatype
SIm(mask) = SecondImage(mask);
subplot(1,2,2);
image(SIm);
axis image
this will pick out the pixels that have changed and show the "before" and "after" content of those pixels. You might want to experiment with
mask = logical(pixels_changed); mask = bwareafilt(mask,[10 inf]); mask = repmat(mask,1,1,3);
  8 件のコメント
Image Analyst
Image Analyst 2016 年 7 月 2 日
Perhaps if they're within a certain distance of each other and they track/translate in synchrony with each other, then they're part of the same moving object. The easy tracking stuff is easy but you'll spend way way more code on handling these kinds of pathological situations like a man in a tan suit walking over a tan walkway, or people who align/overlap to produce one object and then suddenly turn around and way back in the direction they came, or a person getting in a car and then suddenly "disappearing", or two people in red shirts and blue jeans passing in front of each other, etc. Those kinds of bizarre situations always take a lot of special ad-hoc coding.
BlueBee77
BlueBee77 2016 年 7 月 2 日
Yes, you re right. I can ignore this image but the same happens with other images when the skin is exposed or a person has a bald head e.g., image attached. For situation like this i cannot get a perfect boundary or mask. Do you have any idea what should i do for it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by