Enumerations | |
enum | CxImage::OverflowMethod { CxImage::OM_COLOR = 1, CxImage::OM_BACKGROUND = 2, CxImage::OM_TRANSPARENT = 3, CxImage::OM_WRAP = 4, CxImage::OM_REPEAT = 5, CxImage::OM_MIRROR = 6 } |
enum | CxImage::InterpolationMethod { CxImage::IM_NEAREST_NEIGHBOUR = 1, CxImage::IM_BILINEAR = 2, CxImage::IM_BSPLINE = 3, CxImage::IM_BICUBIC = 4, CxImage::IM_BICUBIC2 = 5, CxImage::IM_LANCZOS = 6, CxImage::IM_BOX = 7, CxImage::IM_HERMITE = 8, CxImage::IM_HAMMING = 9, CxImage::IM_SINC = 10, CxImage::IM_BLACKMAN = 11, CxImage::IM_BESSEL = 12, CxImage::IM_GAUSSIAN = 13, CxImage::IM_QUADRATIC = 14, CxImage::IM_MITCHELL = 15, CxImage::IM_CATROM = 16, CxImage::IM_HANNING = 17, CxImage::IM_POWER = 18 } |
Functions | |
void | CxImage::OverflowCoordinates (float &x, float &y, OverflowMethod const ofMethod) |
void | CxImage::OverflowCoordinates (int32_t &x, int32_t &y, OverflowMethod const ofMethod) |
RGBQUAD | CxImage::GetPixelColorWithOverflow (int32_t x, int32_t y, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD *const rplColor=0) |
RGBQUAD | CxImage::GetPixelColorInterpolated (float x, float y, InterpolationMethod const inMethod=IM_BILINEAR, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD *const rplColor=0) |
RGBQUAD | CxImage::GetAreaColorInterpolated (float const xc, float const yc, float const w, float const h, InterpolationMethod const inMethod, OverflowMethod const ofMethod=OM_BACKGROUND, RGBQUAD *const rplColor=0) |
enum CxImage::InterpolationMethod [inherited] |
enum CxImage::OverflowMethod [inherited] |
RGBQUAD CxImage::GetAreaColorInterpolated | ( | float const | xc, | |
float const | yc, | |||
float const | w, | |||
float const | h, | |||
InterpolationMethod const | inMethod, | |||
OverflowMethod const | ofMethod = OM_BACKGROUND , |
|||
RGBQUAD *const | rplColor = 0 | |||
) | [inherited] |
This method is similar to GetPixelColorInterpolated, but this method also properly handles subsampling. If you need to sample original image with interval of more than 1 pixel (as when shrinking an image), you should use this method instead of GetPixelColorInterpolated or aliasing will occur. When area width and height are both less than pixel, this method gets pixel color by interpolating color of frame center with selected (inMethod) interpolation by calling GetPixelColorInterpolated. If width and height are more than 1, method calculates color by averaging color of pixels within area. Interpolation method is not used in this case. Pixel color is interpolated by averaging instead. If only one of both is more than 1, method uses combination of interpolation and averaging. Chosen interpolation method is used, but since it is averaged later on, there is little difference between IM_BILINEAR (perhaps best for this case) and better methods. IM_NEAREST_NEIGHBOUR again leads to aliasing artifacts. This method is a bit slower than GetPixelColorInterpolated and when aliasing is not a problem, you should simply use the later.
xc,yc | - center of (rectangular) area | |
w,h | - width and height of area | |
inMethod | - interpolation method that is used, when interpolation is used (see above) | |
ofMethod | - overflow method used when retrieving individual pixel colors | |
rplColor | - replacement colour to use, in OM_COLOR |
RGBQUAD CxImage::GetPixelColorInterpolated | ( | float | x, | |
float | y, | |||
InterpolationMethod const | inMethod = IM_BILINEAR , |
|||
OverflowMethod const | ofMethod = OM_BACKGROUND , |
|||
RGBQUAD *const | rplColor = 0 | |||
) | [inherited] |
This method reconstructs image according to chosen interpolation method and then returns pixel (x,y). (x,y) can lie between actual image pixels. If (x,y) lies outside of image, method returns value according to overflow method. This method is very useful for geometrical image transformations, where destination pixel can often assume color value lying between source pixels.
(x,y) | - coordinates of pixel to return GPCI method recreates "analogue" image back from digital data, so x and y are float values and color value of point (1.1,1) will generally not be same as (1,1). Center of first pixel is at (0,0) and center of pixel right to it is (1,0). (0.5,0) is half way between these two pixels. | |
inMethod | - interpolation (reconstruction) method (kernel) to use:
| |
ofMethod | - overflow method (see comments at GetPixelColorWithOverflow) | |
rplColor | - pointer to color used for out of borders pixels in OM_COLOR mode (and other modes if colour can't calculated in a specified way) |
RGBQUAD CxImage::GetPixelColorWithOverflow | ( | int32_t | x, | |
int32_t | y, | |||
OverflowMethod const | ofMethod = OM_BACKGROUND , |
|||
RGBQUAD *const | rplColor = 0 | |||
) | [inherited] |
Method return pixel color. Different methods are implemented for out of bounds pixels. If an image has alpha channel, alpha value is returned in .RGBReserved.
x,y | : pixel coordinates | |
ofMethod | : out-of-bounds method:
| |
rplColor | : input color (returned for out-of-bound coordinates in OF_COLOR mode and if other mode is not applicable) |
void CxImage::OverflowCoordinates | ( | int32_t & | x, | |
int32_t & | y, | |||
OverflowMethod const | ofMethod | |||
) | [inherited] |
Recalculates coordinates according to specified overflow method. If pixel (x,y) lies within image, nothing changes.
x,y | - coordinates of pixel | |
ofMethod | - overflow method |
void CxImage::OverflowCoordinates | ( | float & | x, | |
float & | y, | |||
OverflowMethod const | ofMethod | |||
) | [inherited] |
See OverflowCoordinates for integer version