Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Arithmetic and

Logical Operations
on Digital Images
Arithmetic operations on
Images

• Arithmetic operations addition,subtraction, division,and


multiplication which is performed pixel by pixel between
two images or among many images
Addition operation
which is also called pixel addition. addition operator add two
images in pixel by pixel fashion .matlab coding is given below
coding :

>>ima1=imread(‘image1.tif’)
>>ima2-imread(‘image2.tif’);
>>sum=ima1+ima2;
• addition can also done using in-build matlab command
>>imadd(ima1,ima2);

• any integer value can be added to an image matrix


Subtraction operation

• which is also called pixel subtraction. subtraction


operator subtract two images in pixel by pixel
fashion .matlab coding is given below
coding :
>>ima1=imread(‘image1.tif’)
>>ima2-imread(‘image2.tif’);
>>sub=ima1-ima2;
• subtraction can also done using in-build matlab
command
>>imsubtract(ima1,ima2);

• any integer value can be subtracted from an image


matrix
Multiplication operation
• which is also called pixel multiplication.
multiplication operator multiply two images in pixel
by pixel fashion .matlab coding is given below
coding :
>>ima1=imread(‘image1.tif’)
>>ima2-imread(‘image2.tif’);
>>mul=ima1.*ima2;
dot(.) operator used to perform pixel wise operation
• multiplication can also done using in-build matlab
command
>>immultiply(ima1,ima2);

• any integer value can multiply an image matrix


Division operation

• which is also called pixel division.Division operator


divide one image by other in pixel by pixel fashion
.matlab coding is given below
coding :
>>ima1=imread(‘image1.tif’)
>>ima2-imread(‘image2.tif’);
>>mul=ima1./ima2;
dot(.) operator used to perform pixel wise operation.
• division can also done using inbuild matlab command
>>imdivide(ima1,ima2);

• any integer value can divide an image matrix


Application
Adding or subtracting a constant value to/from each image
pixel value can be used to increases/decrease its brightness.

Blending Adding images together produces a composite image


of both input images. This can be used to produce blending
effects using weighted addition.

Multiplication and division can be used as a simple means of


contrast adjustment and extension to addition/subtraction
(e.g. reduce contrast to 25% = division by 4; increase contrast
by 50% = multiplication by 1.5).
Blending (adding)
Logical Operations on Images
• Standard logical operations can be performed between images such
as NOT, OR, XOR, and AND.
• In general, logical operation is performed between each
corresponding bit of the image pixel representation (i.e. a bit-wise
operator).
 NOT (inversion): This inverts the image representation. In the
simplest case of a binary image, the (black) background pixels
become (white) and vice versa.
 OR/XOR: are useful for processing binary-valued images (0 or 1) to
detect objects which have moved between frames. Binary objects
are typically produced through application of thresholding to a grey-
scale image.
 Logical AND: is commonly used for detecting differences in images,
highlighting target regions with a binary mask or producing bit-
planes through an image.

You might also like