![]() |
Leptonica
1.82.0
Image processing and image analysis suite
|
#include "allheaders.h"
Go to the source code of this file.
Functions | |
PIXACC * | pixaccCreate (l_int32 w, l_int32 h, l_int32 negflag) |
PIXACC * | pixaccCreateFromPix (PIX *pix, l_int32 negflag) |
void | pixaccDestroy (PIXACC **ppixacc) |
PIX * | pixaccFinal (PIXACC *pixacc, l_int32 outdepth) |
PIX * | pixaccGetPix (PIXACC *pixacc) |
l_int32 | pixaccGetOffset (PIXACC *pixacc) |
l_ok | pixaccAdd (PIXACC *pixacc, PIX *pix) |
l_ok | pixaccSubtract (PIXACC *pixacc, PIX *pix) |
l_ok | pixaccMultConst (PIXACC *pixacc, l_float32 factor) |
l_ok | pixaccMultConstAccumulate (PIXACC *pixacc, PIX *pix, l_float32 factor) |
Pixacc creation, destruction PIXACC *pixaccCreate() PIXACC *pixaccCreateFromPix() void pixaccDestroy() Pixacc finalization PIX *pixaccFinal() Pixacc accessors PIX *pixaccGetPix() l_int32 pixaccGetOffset() Pixacc accumulators l_int32 pixaccAdd() l_int32 pixaccSubtract() l_int32 pixaccMultConst() l_int32 pixaccMultConstAccumulate() This is a simple interface for some of the pixel arithmetic operations in pixarith.c. These are easy to code up, but not as fast as hand-coded functions that do arithmetic on corresponding pixels. Suppose you want to make a linear combination of pix1 and pix2: pixd = 0.4 * pix1 + 0.6 * pix2 where pix1 and pix2 are the same size and have depth 'd'. Then: Pixacc *pacc = pixaccCreateFromPix(pix1, 0); // first; addition only pixaccMultConst(pacc, 0.4); pixaccMultConstAccumulate(pacc, pix2, 0.6); // Add in 0.6 of the second pixd = pixaccFinal(pacc, d); // Get the result pixaccDestroy(&pacc);
Definition in file pixacc.c.
[in] | pixacc | |
[in] | pix | to be added |
Definition at line 254 of file pixacc.c.
References pixaccGetPix(), and pixAccumulate().
Referenced by pixaccCreateFromPix(), and pixaccMultConstAccumulate().
PIXACC* pixaccCreate | ( | l_int32 | w, |
l_int32 | h, | ||
l_int32 | negflag | ||
) |
[in] | w,h | of 32 bpp internal Pix |
[in] | negflag | 0 if only positive numbers are involved; 1 if there will be negative numbers |
Notes: (1) Use negflag = 1 for safety if any negative numbers are going to be used in the chain of operations. Negative numbers arise, e.g., by subtracting a pix, or by adding a pix that has been pre-multiplied by a negative number. (2) Initializes the internal 32 bpp pix, similarly to the initialization in pixInitAccumulate().
Definition at line 92 of file pixacc.c.
References Pixacc::h, Pixacc::offset, Pixacc::pix, pixaccDestroy(), pixCreate(), pixSetAllArbitrary(), and Pixacc::w.
Referenced by pixaccCreateFromPix(), and pixaccMultConstAccumulate().
[in] | pix | |
[in] | negflag | 0 if only positive numbers are involved; 1 if there will be negative numbers |
Notes: (1) See pixaccCreate()
Definition at line 132 of file pixacc.c.
References pixaccAdd(), pixaccCreate(), and pixGetDimensions().
void pixaccDestroy | ( | PIXACC ** | ppixacc | ) |
[in,out] | ppixacc | will be set to null before returning |
Notes: (1) Always nulls the input ptr.
Definition at line 162 of file pixacc.c.
References Pixacc::pix, and pixDestroy().
Referenced by pixaccCreate(), and pixaccMultConstAccumulate().
[in] | pixacc | |
[in] | outdepth | 8, 16 or 32 bpp |
Definition at line 193 of file pixacc.c.
References pixaccGetOffset(), pixaccGetPix(), and pixFinalAccumulate().
Referenced by pixaccMultConstAccumulate().
l_int32 pixaccGetOffset | ( | PIXACC * | pixacc | ) |
[in] | pixacc |
Definition at line 233 of file pixacc.c.
References Pixacc::offset.
Referenced by pixaccFinal(), and pixaccMultConst().
[in] | pixacc |
Definition at line 216 of file pixacc.c.
References Pixacc::pix.
Referenced by pixaccAdd(), pixaccFinal(), pixaccMultConst(), and pixaccSubtract().
l_ok pixaccMultConst | ( | PIXACC * | pixacc, |
l_float32 | factor | ||
) |
[in] | pixacc | |
[in] | factor |
Definition at line 298 of file pixacc.c.
References pixaccGetOffset(), pixaccGetPix(), and pixMultConstAccumulate().
Referenced by pixaccMultConstAccumulate().
[in] | pixacc | |
[in] | pix | |
[in] | factor |
Notes: (1) This creates a temp pix that is pix multiplied by the constant factor. It then adds that into pixacc.
Definition at line 326 of file pixacc.c.
References pixaccAdd(), pixaccCreate(), pixaccDestroy(), pixaccFinal(), pixaccMultConst(), pixDestroy(), and pixGetDimensions().
[in] | pixacc | |
[in] | pix | to be subtracted |
Definition at line 276 of file pixacc.c.
References pixaccGetPix(), and pixAccumulate().