Select page from this chapter: Coordinate System, Keyboard, stLocal

Coordinate System

The coordinate system used throughout the BWTT is the [r, c] system used by Matlab. [r, c] is the [row, column] coordinates of a pixel, with +ve r down the image and +ve c to the right. This is for the image displayed as it would be in a video player, or by Matlab’s standard image functions (like imshow()), with the first element representing the pixel in the top-left of the image.

Two things need to be considered as a consequence. First, all 2D coordinate data returned by the BWTT is ordered as [r, c]. Thus, to retrieve the x coordinate, you need to choose the second element. Second, the coordinate system is left-handed. Thus, a +ve rotation is clockwise, as the image is viewed. This has bearing when retrieving, for example, head orientation.

To recover [x, y] coordinates from the [r, c] coordinates used by the BWTT, use something like the following code snippet. This snippet recovers a right-handed coordinate [x, y] system that has the bottom-left pixel at [1, 1]. Since the system is right-handed, image-space angles also need to be inverted (mirrored at zero degrees) to be correct in this system.

x = c; y = imageHeight + 1 – r; headOrientation = - headOrientation;