![]() |
Leptonica
1.83.1
Image processing and image analysis suite
|
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 243 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 93 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 131 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 159 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 188 of file pixacc.c.
References pixaccGetOffset(), pixaccGetPix(), and pixFinalAccumulate().
Referenced by pixaccMultConstAccumulate().
l_int32 pixaccGetOffset | ( | PIXACC * | pixacc | ) |
[in] | pixacc |
Definition at line 224 of file pixacc.c.
References Pixacc::offset.
Referenced by pixaccFinal(), and pixaccMultConst().
[in] | pixacc |
Definition at line 209 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 283 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 309 of file pixacc.c.
References pixaccAdd(), pixaccCreate(), pixaccDestroy(), pixaccFinal(), pixaccMultConst(), pixDestroy(), and pixGetDimensions().
[in] | pixacc | |
[in] | pix | to be subtracted |
Definition at line 263 of file pixacc.c.
References pixaccGetPix(), and pixAccumulate().