To specify a world (nondefault spatial) coordinate system for an image, you can use
spatial referencing. The Image Processing
Toolbox™ uses includes two spatial referencing objects,
imref3d, that let you define the
location of the image in a world coordinate system. You can also use these objects to
specify the image resolution, including nonsquare pixel shapes. (Another way to define a
world coordinate system is to use image object
YData properties—see Define World Coordinates Using XData and YData Properties.)
When you create a spatial referencing object, you associate it with a particular image. The object contains information about the image, some of it provided by you and some of it derived by the object. The following table provides descriptions of spatial referencing object fields.
|Upper and lower bounds along the X dimension in world coordinates (nondefault spatial coordinates)|
|Upper and lower bounds along the Y dimension in world coordinates (nondefault spatial coordinates)|
|Size of the image, returned by the |
|Size of pixel along the X dimension|
|Size of pixel along the Y dimension|
|Size of image along the X dimension|
|Size of image along the Y dimension|
|Upper and lower bounds along X dimension in intrinsic coordinates (default spatial coordinates)|
|Upper and lower bounds along Y dimension in intrinsic coordinates (default spatial coordinates).|
To illustrate, this example creates a spatial referencing object associated with a
2-by-2 image. In this image, the world extent is 4 units/pixel in the
x direction and 2 units/pixel in the
direction. To create a spatial referencing object, specify the image dimensions and
individual pixel dimensions as arguments. The object generates the world limits of this
image in the x and y directions.
You could specify other information when creating an object, see
imref2d for more information.
I = [1 2; 3 4] R = imref2d(size(I),4,2)
R = imref2d with properties: XWorldLimits: [2 10] YWorldLimits: [1 5] ImageSize: [2 2] PixelExtentInWorldX: 4 PixelExtentInWorldY: 2 ImageExtentInWorldX: 8 ImageExtentInWorldY: 4 XIntrinsicLimits: [0.5000 2.5000] YIntrinsicLimits: [0.5000 2.5000]
The figure illustrates how these properties map to elements of an image.
Spatial referencing objects support methods for converting between the world,
intrinsic, and subscript coordinate systems. Several toolbox functions accept or return
spatial referencing objects: