Файл src/rotateshear.c

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "allheaders.h"

Функции

PIXpixRotateShear (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
PIXpixRotate2Shear (PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
PIXpixRotate3Shear (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)
PIXpixRotateShearCenter (PIX *pixs, l_float32 angle, l_int32 incolor)
l_int32 pixRotateShearCenterIP (PIX *pixs, l_float32 angle, l_int32 incolor)

Переменные

static const l_float32 VERY_SMALL_ANGLE = 0.001
static const l_float32 MAX_2_SHEAR_ANGLE = 0.05

Функции

PIX* pixRotate2Shear ( PIX pixs,
l_int32  xcen,
l_int32  ycen,
l_float32  angle,
l_int32  incolor 
)

pixRotate2Shear()

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. (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.

PIX* pixRotate3Shear ( PIX pixs,
l_int32  xcen,
l_int32  ycen,
l_float32  angle,
l_int32  incolor 
)

pixRotate3Shear()

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 image center, using the 3-shear method. It can be used for any angle, and should be used for angles larger than MAX_2_SHEAR_ANGLE. (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 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.

PIX* pixRotateShear ( PIX pixs,
l_int32  xcen,
l_int32  ycen,
l_float32  angle,
l_int32  incolor 
)

pixRotateShear()

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.

PIX* pixRotateShearCenter ( PIX pixs,
l_float32  angle,
l_int32  incolor 
)

pixRotateShearCenter()

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 
)

pixRotateShearCenterIP()

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 
)

pixRotateShearIP()

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 image center, using the 3-shear method. (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 MAX_2_SHEAR_ANGLE = 0.05 [static]

const l_float32 VERY_SMALL_ANGLE = 0.001 [static]


Документация по Leptonica. Последние изменения: Fri Aug 7 20:31:38 2009. Создано системой  doxygen 1.5.9