Leptonica
1.54
|
Функции | |
l_int32 | pixAddConstantGray (PIX *pixs, l_int32 val) |
l_int32 | pixMultConstantGray (PIX *pixs, l_float32 val) |
PIX * | pixAddGray (PIX *pixd, PIX *pixs1, PIX *pixs2) |
PIX * | pixSubtractGray (PIX *pixd, PIX *pixs1, PIX *pixs2) |
PIX * | pixThresholdToValue (PIX *pixd, PIX *pixs, l_int32 threshval, l_int32 setval) |
PIX * | pixInitAccumulate (l_int32 w, l_int32 h, l_uint32 offset) |
PIX * | pixFinalAccumulate (PIX *pixs, l_uint32 offset, l_int32 depth) |
PIX * | pixFinalAccumulateThreshold (PIX *pixs, l_uint32 offset, l_uint32 threshold) |
l_int32 | pixAccumulate (PIX *pixd, PIX *pixs, l_int32 op) |
l_int32 | pixMultConstAccumulate (PIX *pixs, l_float32 factor, l_uint32 offset) |
PIX * | pixAbsDifference (PIX *pixs1, PIX *pixs2) |
PIX * | pixMinOrMax (PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 type) |
PIX * | pixMaxDynamicRange (PIX *pixs, l_int32 type) |
l_float32 * | makeLogBase2Tab (void) |
l_float32 | getLogBase2 (l_int32 val, l_float32 *logtab) |
l_float32 getLogBase2 | ( | l_int32 | val, |
l_float32 * | logtab | ||
) |
l_float32* makeLogBase2Tab | ( | void | ) |
PIX* pixAbsDifference | ( | PIX * | pixs1, |
PIX * | pixs2 | ||
) |
Input: pixs1, pixs2 (both either 8 or 16 bpp gray, or 32 bpp RGB) Return: pixd, or null on error
Notes: (1) The depth of pixs1 and pixs2 must be equal. (2) Clips computation to the min size, aligning the UL corners (3) For 8 and 16 bpp, assumes one gray component. (4) For 32 bpp, assumes 3 color components, and ignores the LSB of each word (the alpha channel) (5) Computes the absolute value of the difference between each component value.
l_int32 pixAccumulate | ( | PIX * | pixd, |
PIX * | pixs, | ||
l_int32 | op | ||
) |
Input: pixd (32 bpp) pixs (1, 8, 16 or 32 bpp) op (L_ARITH_ADD or L_ARITH_SUBTRACT) Return: 0 if OK; 1 on error
Notes: (1) This adds or subtracts each pixs value from pixd. (2) This clips to the minimum of pixs and pixd, so they do not need to be the same size. (3) The alignment is to the origin (UL corner) of pixs & pixd.
l_int32 pixAddConstantGray | ( | PIX * | pixs, |
l_int32 | val | ||
) |
Input: pixs (8, 16 or 32 bpp) val (amount to add to each pixel) Return: 0 if OK, 1 on error
Notes: (1) In-place operation. (2) No clipping for 32 bpp. (3) For 8 and 16 bpp, if val > 0 the result is clipped to 0xff and 0xffff, rsp. (4) For 8 and 16 bpp, if val < 0 the result is clipped to 0.
PIX* pixAddGray | ( | PIX * | pixd, |
PIX * | pixs1, | ||
PIX * | pixs2 | ||
) |
Input: pixd (<optional>; this can be null, equal to pixs1, or different from pixs1) pixs1 (can be == to pixd) pixs2 Return: pixd always
Notes: (1) Arithmetic addition of two 8, 16 or 32 bpp images. (2) For 8 and 16 bpp, we do explicit clipping to 0xff and 0xffff, respectively. (3) Alignment is to UL corner. (4) There are 3 cases. The result can go to a new dest, in-place to pixs1, or to an existing input dest: * pixd == null: (src1 + src2) --> new pixd * pixd == pixs1: (src1 + src2) --> src1 (in-place) * pixd != pixs1: (src1 + src2) --> input pixd (5) pixs2 must be different from both pixd and pixs1.
PIX* pixFinalAccumulate | ( | PIX * | pixs, |
l_uint32 | offset, | ||
l_int32 | depth | ||
) |
Input: pixs (32 bpp) offset (same as used for initialization) depth (8, 16 or 32 bpp, of destination) Return: pixd (8, 16 or 32 bpp), or null on error
Notes: (1) The offset must be >= 0 and should not exceed 0x40000000. (2) The offset is subtracted from the src 32 bpp image (3) For 8 bpp dest, the result is clipped to [0, 0xff] (4) For 16 bpp dest, the result is clipped to [0, 0xffff]
PIX* pixFinalAccumulateThreshold | ( | PIX * | pixs, |
l_uint32 | offset, | ||
l_uint32 | threshold | ||
) |
Input: pixs (32 bpp) offset (same as used for initialization) threshold (values less than this are set in the destination) Return: pixd (1 bpp), or null on error
Notes: (1) The offset must be >= 0 and should not exceed 0x40000000. (2) The offset is subtracted from the src 32 bpp image
PIX* pixInitAccumulate | ( | l_int32 | w, |
l_int32 | h, | ||
l_uint32 | offset | ||
) |
Input: w, h (of accumulate array) offset (initialize the 32 bpp to have this value; not more than 0x40000000) Return: pixd (32 bpp), or null on error
Notes: (1) The offset must be >= 0. (2) The offset is used so that we can do arithmetic with negative number results on l_uint32 data; it prevents the l_uint32 data from going negative. (3) Because we use l_int32 intermediate data results, these should never exceed the max of l_int32 (0x7fffffff). We do not permit the offset to be above 0x40000000, which is half way between 0 and the max of l_int32. (4) The same offset should be used for initialization, multiplication by a constant, and final extraction! (5) If you're only adding positive values, offset can be 0.
PIX* pixMaxDynamicRange | ( | PIX * | pixs, |
l_int32 | type | ||
) |
Input: pixs (4, 8, 16 or 32 bpp source) type (L_LINEAR_SCALE or L_LOG_SCALE) Return: pixd (8 bpp), or null on error
Notes: (1) Scales pixel values to fit maximally within the dest 8 bpp pixd (2) Uses a LUT for log scaling
Input: pixd (<optional> destination: this can be null, equal to pixs1, or different from pixs1) pixs1 (can be == to pixd) pixs2 type (L_CHOOSE_MIN, L_CHOOSE_MAX) Return: pixd always
Notes: (1) This gives the min or max of two images. (2) The depth can be 8 or 16 bpp. (3) There are 3 cases:
l_int32 pixMultConstAccumulate | ( | PIX * | pixs, |
l_float32 | factor, | ||
l_uint32 | offset | ||
) |
Input: pixs (32 bpp) factor offset (same as used for initialization) Return: 0 if OK; 1 on error
Notes: (1) The offset must be >= 0 and should not exceed 0x40000000. (2) This multiplies each pixel, relative to offset, by the input factor (3) The result is returned with the offset back in place.
l_int32 pixMultConstantGray | ( | PIX * | pixs, |
l_float32 | val | ||
) |
Input: pixs (8, 16 or 32 bpp) val (>= 0.0; amount to multiply by each pixel) Return: 0 if OK, 1 on error
Notes: (1) In-place operation; val must be >= 0. (2) No clipping for 32 bpp. (3) For 8 and 16 bpp, the result is clipped to 0xff and 0xffff, rsp.
PIX* pixSubtractGray | ( | PIX * | pixd, |
PIX * | pixs1, | ||
PIX * | pixs2 | ||
) |
Input: pixd (<optional>; this can be null, equal to pixs1, or different from pixs1) pixs1 (can be == to pixd) pixs2 Return: pixd always
Notes: (1) Arithmetic subtraction of two 8, 16 or 32 bpp images. (2) Source pixs2 is always subtracted from source pixs1. (3) Do explicit clipping to 0. (4) Alignment is to UL corner. (5) There are 3 cases. The result can go to a new dest, in-place to pixs1, or to an existing input dest: (a) pixd == null (src1 - src2) --> new pixd (b) pixd == pixs1 (src1 - src2) --> src1 (in-place) (d) pixd != pixs1 (src1 - src2) --> input pixd (6) pixs2 must be different from both pixd and pixs1.
Input: pixd (<optional>; if not null, must be equal to pixs) pixs (8, 16, 32 bpp) threshval setval Return: pixd always
Notes: