Image Arithmetic: - Imabsdif - Imadd - Imcomplement - Imdivide - Imlincomb - Immultiply - Imsubtract

You might also like

Download as ppsx, pdf, or txt
Download as ppsx, pdf, or txt
You are on page 1of 11

Image Arithmetic

imabsdif
imadd
imcomplement
imdivide

imlincomb
immultiply
imsubtract

Adding Images
I = imread(rice.tif);
J = imread(cameraman.tif);
K = imadd(I, J);
imshow(K)

Brighten an image results saturation


RGB = imread(flowers.tif);
RGB2 = imadd(RGB, 50);
subplot(1, 2, 1); imshow(RGB);
subplot(1, 2, 2); imshow(RGB2);

Adding Images (cont.)

Adding Images (cont.)

Subtracting Images
Background of a scene
rice = imread(rice.tif);
background = imopen(rice, strel(disk, 15));
rice2 = imsubtract(rice, background);
imshow(rice), figure, imshow(rice2);

Negative values
imabsdif

Subtracting Images (cont.)

Multiplying Images
Scaling: multiply by a constant
(brightens >1, darkens <1)

Preserves relative contrast


I = imread(moon.tif);
J = immultiply(I, 1.2);
imshow(I);
figure, imshow(J)

Multiplying Images (cont.)

Dividing Images (Ratioing)


I = imread(rice.tif);
background = imopen(I, strel(disk, 15));
Ip = imdivide(I, background);
imshow(Ip, [])

Linear combination only truncates


the final result
K = imlincomb(.5, I, .5, I2);

Dividing Images (cont.)

THANK YOU

You might also like