immultiply
Multiply two images or multiply image by constant
Syntax
Description
Examples
Multiply an Image by Itself
Read a grayscale image into the workspace, then convert the image to uint8
.
I = imread('moon.tif');
I16 = uint16(I);
Multiply the image by itself. Note that immultiply
converts the class of the image from uint8
to uint16
before performing the multiplication to avoid truncating the results.
J = immultiply(I16,I16);
Show the original image and the processed image.
imshow(I)
figure imshow(J)
Scale an Image by a Constant Factor
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.
imshow(I)
figure imshow(J)
Input Arguments
X
— First array
numeric array | logical array
First array, specified as a numeric array or logical array of any dimension.
Y
— Second array
numeric scalar | numeric array | logical array
Second array to be multiplied with X
, specified as a
numeric scalar, numeric array, or logical array.
If
X
is numeric, then the size and class ofY
can have one of the following values:Y
is the same size and class asX
.Y
is the same size asX
and is logical.Y
is a scalar of typedouble
.
If
X
is logical, thenY
must have the same size asX
.Y
can be any class.
Output Arguments
Z
— Product
numeric array
Product, returned as a numeric array.
immultiply
computes each element of
Z
individually in double-precision floating point.
If X
or Y
is an integer array,
then elements of Z
exceeding the range of the integer
type are truncated, and fractional values are rounded.
Tips
Version History
Introduced before R2006a
See Also
imabsdiff
| imadd
| imcomplement
| imdivide
| imlincomb
| imsubtract
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)