Leptonica 1.68
C Image Processing Library

rotateorth.c File Reference

Orthogonal image rotation and flips. More...

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

Go to the source code of this file.

Functions

PIXpixRotateOrth (PIX *pixs, l_int32 quads)
PIXpixRotate180 (PIX *pixd, PIX *pixs)
PIXpixRotate90 (PIX *pixs, l_int32 direction)
PIXpixFlipLR (PIX *pixd, PIX *pixs)
PIXpixFlipTB (PIX *pixd, PIX *pixs)

Detailed Description

Orthogonal image rotation and flips.

    Top-level rotation by multiples of 90 degrees
          PIX     *pixRotateOrth()

    180-degree rotation
          PIX     *pixRotate180()

    90-degree rotation (both directions)
          PIX     *pixRotate90()

    Left-right flip
          PIX     *pixFlipLR()

    Top-bottom flip
          PIX     *pixFlipTB()

Definition in file rotateorth.c.


Function Documentation

PIX* pixRotateOrth ( PIX pixs,
l_int32  quads 
)

pixRotateOrth()

Input: pixs (all depths) quads (0-3; number of 90 degree cw rotations) Return: pixd, or null on error

Definition at line 49 of file rotateorth.c.

References ERROR_PTR, NULL, pixCopy(), pixRotate180(), pixRotate90(), and PROCNAME.

Referenced by main(), pixDeskewBarcode(), pixFindNormalizedSquareSum(), pixFindSkewOrthogonalRange(), and TestProjection().

PIX* pixRotate180 ( PIX pixd,
PIX pixs 
)

pixRotate180()

Input: pixd (<optional>; can be null, equal to pixs, or different from pixs) pixs (all depths) Return: pixd, or null on error

Notes: (1) This does a 180 rotation of the image about the center, which is equivalent to a left-right flip about a vertical line through the image center, followed by a top-bottom flip about a horizontal line through the image center. (2) There are 3 cases for input: (a) pixd == null (creates a new pixd) (b) pixd == pixs (in-place operation) (c) pixd != pixs (existing pixd) (3) For clarity, use these three patterns, respectively: (a) pixd = pixRotate180(NULL, pixs); (b) pixRotate180(pixs, pixs); (c) pixRotate180(pixd, pixs);

Definition at line 93 of file rotateorth.c.

References ERROR_PTR, NULL, pixCopy(), pixFlipLR(), pixFlipTB(), pixGetDepth(), and PROCNAME.

Referenced by main(), pixRotateOrth(), and RotateOrthTest().

PIX* pixRotate90 ( PIX pixs,
l_int32  direction 
)

pixRotate90()

Input: pixs (all depths) direction (1 = clockwise, -1 = counter-clockwise) Return: pixd, or null on error

Notes: (1) This does a 90 degree rotation of the image about the center, either cw or ccw, returning a new pix. (2) The direction must be either 1 (cw) or -1 (ccw).

Definition at line 130 of file rotateorth.c.

References ERROR_PTR, NULL, pixCopyColormap(), pixCopyInputFormat(), pixCopyResolution(), pixCreate(), pixGetData(), pixGetDepth(), pixGetHeight(), pixGetWidth(), pixGetWpl(), PROCNAME, and rotate90Low().

Referenced by main(), pixOrientDetect(), pixOrientDetectDwa(), pixReadFromTiffStream(), pixRotateOrth(), and RotateOrthTest().

PIX* pixFlipLR ( PIX pixd,
PIX pixs 
)

pixFlipLR()

Input: pixd (<optional>; can be null, equal to pixs, or different from pixs) pixs (all depths) Return: pixd, or null on error

Notes: (1) This does a left-right flip of the image, which is equivalent to a rotation out of the plane about a vertical line through the image center. (2) There are 3 cases for input: (a) pixd == null (creates a new pixd) (b) pixd == pixs (in-place operation) (c) pixd != pixs (existing pixd) (3) For clarity, use these three patterns, respectively: (a) pixd = pixFlipLR(NULL, pixs); (b) pixFlipLR(pixs, pixs); (c) pixFlipLR(pixd, pixs); (4) If an existing pixd is not the same size as pixs, the image data will be reallocated.

Definition at line 191 of file rotateorth.c.

References CALLOC, ERROR_PTR, flipLRLow(), FREE, makeReverseByteTab1(), makeReverseByteTab2(), makeReverseByteTab4(), NULL, pixCopy(), pixGetData(), pixGetDimensions(), pixGetWpl(), and PROCNAME.

Referenced by pixaGenerateFont(), pixMirroredTiling(), pixReadFromTiffStream(), pixRotate180(), and RotateOrthTest().

PIX* pixFlipTB ( PIX pixd,
PIX pixs 
)

pixFlipTB()

Input: pixd (<optional>; can be null, equal to pixs, or different from pixs) pixs (all depths) Return: pixd, or null on error

Notes: (1) This does a top-bottom flip of the image, which is equivalent to a rotation out of the plane about a horizontal line through the image center. (2) There are 3 cases for input: (a) pixd == null (creates a new pixd) (b) pixd == pixs (in-place operation) (c) pixd != pixs (existing pixd) (3) For clarity, use these three patterns, respectively: (a) pixd = pixFlipTB(NULL, pixs); (b) pixFlipTB(pixs, pixs); (c) pixFlipTB(pixd, pixs); (4) If an existing pixd is not the same size as pixs, the image data will be reallocated.

Definition at line 264 of file rotateorth.c.

References CALLOC, ERROR_PTR, flipTBLow(), FREE, NULL, pixCopy(), pixGetData(), pixGetDimensions(), pixGetWpl(), and PROCNAME.

Referenced by pixMirroredTiling(), pixReadFromTiffStream(), pixRotate180(), and RotateOrthTest().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines