Read an RGB image into the workspace. View the size of the image.
I = imread('peppers.png');
size(I)
ans = 1×3
384 512 3
Create an imref2d spatial referencing object with the same dimensions as the image. The object does not retain information about the third dimension of the image array.
TF — Flag indicating size compatibility logical scalar
Flag indicating size compatibility, returned as a logical scalar.
TF is True if the size of the
image A is consistent with the referencing object
R. When R is:
An imref2d
spatial referencing object, TF returns true
when R.ImageSize == [size(A,1)
size(A,2)].
Note
The dimensionality of A does not need
to match the dimensionality of an imref2d
spatial referencing object. For example, an RGB image can be
consistent with an imref2d object. In
this case, sizesMatch ignores the third
image dimension.
An imref3d
spatial referencing object, TF returns true
when R.ImageSize == size(A).
A must be a 3-D array.
Data Types: logical
Introduced in R2013a
Open Example
A modified version of this example exists on your system. Do you want to open this version instead?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
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.