imsubtract
从一个图像中减去另一个图像或从图像中减去常量
说明
示例
将两个 uint8 数组相减
以下示例说明如何将两个 uint8
数组相减。您将看到,负数结果会舍入到 0。
X = uint8([ 255 0 75; 44 225 100]); Y = uint8([ 50 50 50; 50 50 50 ]); Z = imsubtract(X,Y)
Z = 2x3 uint8 matrix
205 0 25
0 175 50
减去图像背景
将灰度图像读入工作区。
I = imread('rice.png');
估计背景。
background = imopen(I,strel('disk',15));
从图像中减去背景。
J = imsubtract(I,background);
显示原始图像和处理后的图像。
imshow(I)
figure imshow(J)
从图像中减去常量
将图像读入工作区。
I = imread('rice.png');
从图像中减去常量值。
J = imsubtract(I,50);
显示原始图像和结果。
imshow(I)
figure imshow(J)
输入参数
输出参量
版本历史记录
在 R2006a 之前推出
另请参阅
imabsdiff
| imadd
| imcomplement
| imdivide
| imlincomb
| immultiply
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)