separating object and bacground with imsubtract

1 回表示 (過去 30 日間)
Megah Putri
Megah Putri 2011 年 8 月 17 日
how to separating object and background with imsubstract??
  2 件のコメント
David Young
David Young 2011 年 8 月 17 日
Why do you want to use imsubtract?
Megah Putri
Megah Putri 2011 年 8 月 17 日
hhmm... maybe you know the other way?

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

回答 (2 件)

Image Analyst
Image Analyst 2011 年 8 月 17 日
How about
subtractedImage = single(originalImage) - single(backgroundImage);
  2 件のコメント
Megah Putri
Megah Putri 2011 年 8 月 17 日
image analyst, I've used it before, but can not change the background..whats wrong?
Image Analyst
Image Analyst 2011 年 8 月 18 日
Because backgroundImage is on the RIGHT side of the equation, not the left side. So the background image does not change. If you're saying that the subtractedImage does not change then you'll have to provide sample images (originalImage and backgroundImage) and code that proves that subtractedImage does not change. It should change - the only way it wouldn't change is if backgroundImage were all zeros. Just a guess . . . you DID remember to cast your integer images into single or double like I showed you, right? Otherwise you'll get clipping of the negative numbers to zero.

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


Alex Taylor
Alex Taylor 2012 年 1 月 31 日
I just wanted to add, as whenever this issue comes up, that Image Analyst's solution of using the MATLAB minus operator instead of imsubtract is the recommended way to perform basic math operations on images in MATLAB.
The IPT versions of these math operations (imadd, imsubtract, immultiply, imdivide) predate the support for non-double math operations in core MATLAB. We leave them in the product primarily for compatibility purposes.

Community Treasure Hunt

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

Start Hunting!

Translated by