image arithmetic operations in matlab

Image Arithmetic Operations in matlab

Arithmetic operators are applied in a pixel-by-pixel way, i.e. the value of a pixel in the output image depends only on the values of the corresponding pixels in the input images. so the the images must be of the same size. Image arithmetic is the most simple form of image processing, hence it has wide range of applications.

Image Addition

To add two images or add a constant value to an image, use the imadd function. imadd is matlab inbulit function, It adds the value of each pixel in one of the input images with the corresponding pixel in the other input image and returns the sum in the corresponding pixel of the output image.

Output
output_add_constant_factor
output_add_constant_factor

imadd method can be used to brighten an image by adding a constant value to each pixel.

 

output_image_addition
output_image_addition

download code:

Image Subtraction

imsubtract is inbuilt matlab function to subtract one image from another, or subtract a constant value from an image, use the imsubtract function. imsubtract subtracts each pixel value in one of the input images from the corresponding pixel in the other input image and returns the result in the corresponding pixel in an output image. Image subtraction can be used for more complex image processing.

You can use image subtraction to detect changes in a series of images of the same scene. For this operation the images must be the same size and class.

OUTPUT
output_image_subtraction
output_image_subtraction

Image Multiplication

immultiply is inbuilt matlab function to multiply one image with another, or multiply a constant value from an image, use the immultiply function. immultiply multiplies each pixel value in one of the input images from the corresponding pixel in the other input image and returns the result in the corresponding pixel in an output image. if elements of output_image exceeding the range of the integer type are truncated, and fractional values are rounded. Image multiplication can be used for more complex image processing.