Multiply two images or multiply image by constant
Z = immultiply(X,Y)
immultiply computes each element of
individually in double-precision floating point. If
Y is an integer array, then elements of
Z exceeding the range of the integer type are truncated, and
fractional values are rounded.
Y are numeric arrays of the
same size and class, you can use the expression
X.*Y instead of
Read a grayscale image into the workspace, then convert the image to
I = imread('moon.tif'); I16 = uint16(I);
Multiply the image by itself. Note that
immultiply converts the class of the image from
uint16 before performing the multiplication to avoid truncating the results.
J = immultiply(I16,I16);
Show the original image and the processed image.
Read an image into the workspace.
I = imread('moon.tif');
Scale each value of the image by a constant factor of 0.5.
J = immultiply(I,0.5);
Display the original image and the processed image.
X— First array
First array, specified as a real, nonsparse, numeric or logical array of any dimension.
Y— Second array
Second array to be multiplied with
X, specified as a
real, nonsparse, numeric or logical array.
X is numeric, then the size and class
Y can have one of the following values:
Y is the same size and class
Y is the same size as
X and is logical.
Y is a scalar of type
X is logical, then
Y must have the same size as
Y can be any