# Image Coordinate Standard

To provide a uniform treatment of image coordinates between modules, independently of image size / resolution (different modules may use different image resolutions), it is convenient to adopt the following standard:

• Let the image have size (w, h), where w is the image width and h is the image height.
• Let the image coordinates be (u,v), in pixel units, where u is the horizontal coordinate, starting at the top-left corner and growing to the right, and v is the vertical image coordinate, starting at the top-left corner and growing to the bottom.
• The normalized image coordinates are defined as:

x = 2*u/w - 1

y = 2*v/h - 1

Thus, the normalized image coordinates (both x and y) are in the range [-1,1], being 0 the center of the image, -1 the left/top boundaries, and 1 the right/bottom boundaries.

The x coordinate starts at the image center and grows to the right. The y coordinate starts at the image center and grows to the bottom.

To go back to image pixels, the following expressions should be used:

u = w*(x+1)/2

v = h*(y+1)/2