libprofit differentiates pixels from actual image coordinates. Pixels are the individual dots that make up an image, but from the profiles’ point of view the area where the image is drawn is a continuum coordinate space. Profiles use this coordinates to perform their calculations, as they are more fine grained than individual pixels.
At the model level there are two sets of parameters that control these two different aspects of the image:
heightparameters indicate the width and height of the image in numbers of pixels.
scale_yparameters indicate the horizontal and vertical scale to convert the
heightparameters into image coordinate sizes.
This is shown in the following example:
In the example an image is shown using both their pixels
and their image coordinates.
Each square on the grid represents a pixel on the image,
which are indexed in red.
width is 4, and its
height is also 4.
Shown in blue on the other hand
are the image coordinates.
scale_x is 2 and its
scale_y is also 2.
Finally a point is indicated in the image.
Its image coordinates are
and is contained within the
Profiles use image coordinate to perform their calculations
but still need to store only one value per pixel.
For this purpose the quantities
are stored by libprofit at the model level,
making them available to all profiles to use.
They indicate the width and height of each pixel
in image coordinates.
In most cases profiles evaluate a pixel’s value
using the pixel’s center point in image coordinates;
that is, evaluating at
x = i*scale_x + scale_x/2,
i is the horizontal pixel index,
and likewise for the vertical coordinate.
In other cases, like in the
sub-sampling needs to be performed
to achieve an accurate result.