This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Define World Coordinates Using Spatial Referencing

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, imref2d and 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 XData and 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.

FieldDescription
XWorldLimitsUpper and lower bounds along the X dimension in world coordinates (nondefault spatial coordinates)
YWorldLimitsUpper and lower bounds along the Y dimension in world coordinates (nondefault spatial coordinates)
ImageSizeSize of the image, returned by the size function.
PixelExtentInWorldXSize of pixel along the X dimension
PixelExtentInWorldYSize of pixel along the Y dimension
ImageExtentInWorldXSize of image along the X dimension
ImageExtentInWorldYSize of image along the Y dimension
XIntrinsicLimitsUpper and lower bounds along X dimension in intrinsic coordinates (default spatial coordinates)
YIntrinsicLimitsUpper 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 y 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 following 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: imwarp, imshow, imshowpair, imfuse, imregtform, and imregister.