#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "allheaders.h"
Макросы | |
#define | DEBUG 0 |
Функции | |
static l_float32 | normalizeAngleForShear (l_float32 radang, l_float32 mindist) |
PIX * | pixHShear (PIX *pixd, PIX *pixs, l_int32 liney, l_float32 radang, l_int32 incolor) |
PIX * | pixVShear (PIX *pixd, PIX *pixs, l_int32 linex, l_float32 radang, l_int32 incolor) |
PIX * | pixHShearCorner (PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor) |
PIX * | pixVShearCorner (PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor) |
PIX * | pixHShearCenter (PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor) |
PIX * | pixVShearCenter (PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor) |
l_int32 | pixHShearIP (PIX *pixs, l_int32 liney, l_float32 radang, l_int32 incolor) |
l_int32 | pixVShearIP (PIX *pixs, l_int32 linex, l_float32 radang, l_int32 incolor) |
Переменные | |
static const l_float32 | MIN_DIFF_FROM_HALF_PI = 0.04 |
#define DEBUG 0 |
Input: pixd (<optional>, this can be null, equal to pixs, or different from pixs) pixs (no restrictions on depth) liney (location of horizontal line, measured from origin) angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, always
Notes: (1) There are 3 cases: (a) pixd == null (make a new pixd) (b) pixd == pixs (in-place) (c) pixd != pixs (2) For these three cases, use these patterns, respectively: pixd = pixHShear(NULL, pixs, ...); pixHShear(pixs, pixs, ...); pixHShear(pixd, pixs, ...); (3) This shear leaves the horizontal line of pixels at y = liney invariant. For a positive shear angle, pixels above this line are shoved to the right, and pixels below this line move to the left. (4) With positive shear angle, this can be used, along with pixVShear(), to perform a cw rotation, either with 2 shears (for small angles) or in the general case with 3 shears. (5) Changing the value of liney is equivalent to translating the result horizontally. (6) This brings in 'incolor' pixels from outside the image. (7) For in-place operation, pixs cannot be colormapped, because the in-place operation only blits in 0 or 1 bits, not an arbitrary colormap index. (8) The angle is brought into the range [-pi, -pi]. It is not permitted to be within MIN_DIFF_FROM_HALF_PI radians from either -pi/2 or pi/2.
Input: pixd (<optional>, if not null, must be equal to pixs) pixs angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) See pixHShear() for usage. (2) This does a horizontal shear about the center, with (+) shear pushing increasingly leftward (-x) with increasing y.
Input: pixd (<optional>, if not null, must be equal to pixs) pixs angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) See pixHShear() for usage. (2) This does a horizontal shear about the UL corner, with (+) shear pushing increasingly leftward (-x) with increasing y.
Input: pixs liney (location of horizontal line, measured from origin) angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: 0 if OK; 1 on error
Notes: (1) This is an in-place version of pixHShear(); see comments there. (2) This brings in 'incolor' pixels from outside the image. (3) pixs cannot be colormapped, because the in-place operation only blits in 0 or 1 bits, not an arbitrary colormap index. (4) Does a horizontal full-band shear about the line with (+) shear pushing increasingly leftward (-x) with increasing y.
Input: pixd (<optional>, this can be null, equal to pixs, or different from pixs) pixs (no restrictions on depth) linex (location of vertical line, measured from origin) angle (in radians; not too close to +-(pi / 2)) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error
Notes: (1) There are 3 cases: (a) pixd == null (make a new pixd) (b) pixd == pixs (in-place) (c) pixd != pixs (2) For these three cases, use these patterns, respectively: pixd = pixVShear(NULL, pixs, ...); pixVShear(pixs, pixs, ...); pixVShear(pixd, pixs, ...); (3) This shear leaves the vertical line of pixels at x = linex invariant. For a positive shear angle, pixels to the right of this line are shoved downward, and pixels to the left of the line move upward. (4) With positive shear angle, this can be used, along with pixHShear(), to perform a cw rotation, either with 2 shears (for small angles) or in the general case with 3 shears. (5) Changing the value of linex is equivalent to translating the result vertically. (6) This brings in 'incolor' pixels from outside the image. (7) For in-place operation, pixs cannot be colormapped, because the in-place operation only blits in 0 or 1 bits, not an arbitrary colormap index. (8) The angle is brought into the range [-pi, -pi]. It is not permitted to be within MIN_DIFF_FROM_HALF_PI radians from either -pi/2 or pi/2.
Input: pixd (<optional>, if not null, must be equal to pixs) pixs angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) See pixVShear() for usage. (2) This does a vertical shear about the center, with (+) shear pushing increasingly downward (+y) with increasing x.
Input: pixd (<optional>, if not null, must be equal to pixs) pixs angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: pixd, or null on error.
Notes: (1) See pixVShear() for usage. (2) This does a vertical shear about the UL corner, with (+) shear pushing increasingly downward (+y) with increasing x.
Input: pixs (all depths; not colormapped) linex (location of vertical line, measured from origin) angle (in radians) incolor (L_BRING_IN_WHITE, L_BRING_IN_BLACK); Return: 0 if OK; 1 on error
Notes: (1) This is an in-place version of pixVShear(); see comments there. (2) This brings in 'incolor' pixels from outside the image. (3) pixs cannot be colormapped, because the in-place operation only blits in 0 or 1 bits, not an arbitrary colormap index. (4) Does a vertical full-band shear about the line with (+) shear pushing increasingly downward (+y) with increasing x.
const l_float32 MIN_DIFF_FROM_HALF_PI = 0.04 [static] |