Documentation Center

  • Trial Software
  • Product Updates

worldToIntrinsic

Class: imref2d

Convert from world to intrinsic coordinates

Syntax

[xIntrinsic,yIntrinsic] = worldToIntrinsic(R,xWorld,yWorld)

Description

[xIntrinsic,yIntrinsic] = worldToIntrinsic(R,xWorld,yWorld) maps point locations from the world system (xWorld, yWorld) to the intrinsic system (xIntrinsic, yIntrinsic) based on the relationship defined by the spatial referencing object R. If the input includes values that fall outside the limits of the image in the world system, the worldToIntrinsic method extrapolates xWorld and yWorld outside the bounds of the image in the intrinsic system.

Input Arguments

R

Spatial referencing object, imref2d, associated with an image.

xWorld

Coordinates in X dimension in world system, specified as a numeric scalar or vector.

yWorld

Coordinate in Y dimension in world system, specified as a numeric scalar or vector.

Output Arguments

xIntrinsic

Coordinates in X dimension in intrinsic system, returned as a numeric scalar or vector.

yIntrinsic

Coordinates in Y dimension in intrinsic system, returned as a numeric scalar or vector.

Examples

expand all

Convert World Coordinates to Intrinsic

Read an image.

 I = imread('cameraman.tif');

Create an imref2d object.

 R = imref2d(size(I))
R = 

  imref2d

  Properties:
           XWorldLimits: [0.5000 256.5000]
           YWorldLimits: [0.5000 256.5000]
              ImageSize: [256 256]
    PixelExtentInWorldX: 1
    PixelExtentInWorldY: 1
    ImageExtentInWorldX: 256
    ImageExtentInWorldY: 256
       XIntrinsicLimits: [0.5000 256.5000]
       YIntrinsicLimits: [0.5000 256.5000]

Convert coordinates from world to intrinsic. In this example, world coordinates align with intrinsic coordinates.

 [xi yi] = worldToIntrinsic(R,5,5)
xi =

     5


yi =

     5
Was this topic helpful?