Image Processing Toolbox | ![]() ![]() |
Dividing Images
To divide two images, use the imdivide
function. The imdivide
function does an element-by-element division (./
) of each corresponding pixel in a pair of input images. The immultiply
function returns the result in the corresponding pixel in an output image.
Image division, like image subtraction, can be used to detect changes in two images. However, instead of giving the absolute change for each pixel, division gives the fractional change or ratio between corresponding pixel values. Image division is also called ratioing.
For example, the following code divides the rice grain image by a morphologically opened version of the itself. (For information about morphological image processing, see Morphological Operations.) The images must be the same size and class.
I = imread('rice.tif'); background = imopen(I, strel('disk',15)); Ip = imdivide(I,background); imshow(Ip,[])
![]() | Multiplying Images | Nesting Calls to Image Arithmetic Functions | ![]() |