Leptonica
1.54
|
Функции | |
PIX * | pixRotateShear (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor) |
PIX * | pixRotate2Shear (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor) |
PIX * | pixRotate3Shear (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor) |
l_int32 | pixRotateShearIP (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor) |
PIX * | pixRotateShearCenter (PIX *pixs, l_float32 angle, l_int32 incolor) |
l_int32 | pixRotateShearCenterIP (PIX *pixs, l_float32 angle, l_int32 incolor) |
Переменные | |
static const l_float32 | MIN_ANGLE_TO_ROTATE = 0.001 |
static const l_float32 | MAX_2_SHEAR_ANGLE = 0.06 |
static const l_float32 | LIMIT_SHEAR_ANGLE = 0.35 |
Input: pixs xcen, ycen (center of rotation) angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) This rotates the image about the given point, using the 2-shear method. It should only be used for angles smaller than MAX_2_SHEAR_ANGLE. For larger angles, a warning is issued. (2) A positive angle gives a clockwise rotation. (3) 2-shear rotation by a specified angle is equivalent to the sequential transformations x' = x + tan(angle) * (y - ycen) for x-shear y' = y + tan(angle) * (x - xcen) for y-shear (4) Computation of tan(angle) is performed within the shear operation. (5) This brings in 'incolor' pixels from outside the image. (6) If the image has an alpha layer, it is rotated separately by two shears.
Input: pixs xcen, ycen (center of rotation) angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) This rotates the image about the given point, using the 3-shear method. It should only be used for angles smaller than LIMIT_SHEAR_ANGLE. For larger angles, a warning is issued. (2) A positive angle gives a clockwise rotation. (3) 3-shear rotation by a specified angle is equivalent to the sequential transformations y' = y + tan(angle/2) * (x - xcen) for first y-shear x' = x + sin(angle) * (y - ycen) for x-shear y' = y + tan(angle/2) * (x - xcen) for second y-shear (4) Computation of tan(angle) is performed in the shear operations. (5) This brings in 'incolor' pixels from outside the image. (6) If the image has an alpha layer, it is rotated separately by two shears. (7) The algorithm was published by Alan Paeth: "A Fast Algorithm for General Raster Rotation," Graphics Interface '86, pp. 77-81, May 1986. A description of the method, along with an implementation, can be found in Graphics Gems, p. 179, edited by Andrew Glassner, published by Academic Press, 1990.
Input: pixs xcen (x value for which there is no horizontal shear) ycen (y value for which there is no vertical shear) angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) This rotates an image about the given point, using either 2 or 3 shears. (2) A positive angle gives a clockwise rotation. (3) This brings in 'incolor' pixels from outside the image. (4) For rotation angles larger than about 0.35 radians, we issue a warning because you should probably be using another method (either sampling or area mapping)
PIX* pixRotateShearCenter | ( | PIX * | pixs, |
l_float32 | angle, | ||
l_int32 | incolor | ||
) |
Input: pixs angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: pixd, or null on error
l_int32 pixRotateShearCenterIP | ( | PIX * | pixs, |
l_float32 | angle, | ||
l_int32 | incolor | ||
) |
Input: pixs angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: 0 if OK, 1 on error
l_int32 pixRotateShearIP | ( | PIX * | pixs, |
l_int32 | xcen, | ||
l_int32 | ycen, | ||
l_float32 | angle, | ||
l_int32 | incolor | ||
) |
Input: pixs (any depth; not colormapped) xcen, ycen (center of rotation) angle (radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK) Return: 0 if OK; 1 on error
Notes: (1) This does an in-place rotation of the image about the specified point, using the 3-shear method. It should only be used for angles smaller than LIMIT_SHEAR_ANGLE. For larger angles, a warning is issued. (2) A positive angle gives a clockwise rotation. (3) 3-shear rotation by a specified angle is equivalent to the sequential transformations y' = y + tan(angle/2) * (x - xcen) for first y-shear x' = x + sin(angle) * (y - ycen) for x-shear y' = y + tan(angle/2) * (x - xcen) for second y-shear (4) Computation of tan(angle) is performed in the shear operations. (5) This brings in 'incolor' pixels from outside the image. (6) The pix cannot be colormapped, because the in-place operation only blits in 0 or 1 bits, not an arbitrary colormap index.
const l_float32 LIMIT_SHEAR_ANGLE = 0.35 [static] |
const l_float32 MAX_2_SHEAR_ANGLE = 0.06 [static] |
const l_float32 MIN_ANGLE_TO_ROTATE = 0.001 [static] |