Leptonica  1.54
Файл src/graymorph.c
#include "allheaders.h"

Функции

static PIXpixErodeGray3h (PIX *pixs)
static PIXpixErodeGray3v (PIX *pixs)
static PIXpixDilateGray3h (PIX *pixs)
static PIXpixDilateGray3v (PIX *pixs)
static void dilateGrayLow (l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 size, l_int32 direction, l_uint8 *buffer, l_uint8 *maxarray)
static void erodeGrayLow (l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 size, l_int32 direction, l_uint8 *buffer, l_uint8 *minarray)
PIXpixErodeGray (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixDilateGray (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixOpenGray (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixCloseGray (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixErodeGray3 (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixDilateGray3 (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixOpenGray3 (PIX *pixs, l_int32 hsize, l_int32 vsize)
PIXpixCloseGray3 (PIX *pixs, l_int32 hsize, l_int32 vsize)

Функции

static void dilateGrayLow ( l_uint32 datad,
l_int32  w,
l_int32  h,
l_int32  wpld,
l_uint32 datas,
l_int32  wpls,
l_int32  size,
l_int32  direction,
l_uint8 buffer,
l_uint8 maxarray 
) [static]

dilateGrayLow()

Input: datad, w, h, wpld (8 bpp image) datas, wpls (8 bpp image, of same dimensions) size (full length of SEL; restricted to odd numbers) direction (L_HORIZ or L_VERT) buffer (holds full line or column of src image pixels) maxarray (array of dimension 2*size+1) Return: void

Notes: (1) To eliminate border effects on the actual image, these images are prepared with an additional border of dimensions: leftpix = 0.5 * size rightpix = 1.5 * size toppix = 0.5 * size bottompix = 1.5 * size and we initialize the src border pixels to 0. This allows full processing over the actual image; at the end the border is removed. (2) Uses algorithm of van Herk, Gil and Werman

static void erodeGrayLow ( l_uint32 datad,
l_int32  w,
l_int32  h,
l_int32  wpld,
l_uint32 datas,
l_int32  wpls,
l_int32  size,
l_int32  direction,
l_uint8 buffer,
l_uint8 minarray 
) [static]

erodeGrayLow()

Input: datad, w, h, wpld (8 bpp image) datas, wpls (8 bpp image, of same dimensions) size (full length of SEL; restricted to odd numbers) direction (L_HORIZ or L_VERT) buffer (holds full line or column of src image pixels) minarray (array of dimension 2*size+1) Return: void

Notes: (1) See notes in dilateGrayLow()

PIX* pixCloseGray ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixCloseGray()

Input: pixs hsize (of Sel; must be odd; origin implicitly in center) vsize (ditto) Return: pixd

Notes: (1) Sel is a brick with all elements being hits (2) If hsize = vsize = 1, just returns a copy.

PIX* pixCloseGray3 ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixCloseGray3()

Input: pixs (8 bpp, not cmapped) hsize (1 or 3) vsize (1 or 3) Return: pixd, or null on error

Notes: (1) Special case for 1x3, 3x1 or 3x3 brick sel (all hits) (2) If hsize = vsize = 1, just returns a copy.

PIX* pixDilateGray ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixDilateGray()

Input: pixs hsize (of Sel; must be odd; origin implicitly in center) vsize (ditto) Return: pixd

Notes: (1) Sel is a brick with all elements being hits (2) If hsize = vsize = 1, just returns a copy.

PIX* pixDilateGray3 ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixDilateGray3()

Input: pixs (8 bpp, not cmapped) hsize (1 or 3) vsize (1 or 3) Return: pixd, or null on error

Notes: (1) Special case for 1x3, 3x1 or 3x3 brick sel (all hits) (2) If hsize = vsize = 1, just returns a copy.

static PIX * pixDilateGray3h ( PIX pixs) [static]

pixDilateGray3h()

Input: pixs (8 bpp, not cmapped) Return: pixd, or null on error

Notes: (1) Special case for horizontal 3x1 brick Sel; also used as the first step for the 3x3 brick Sel.

static PIX * pixDilateGray3v ( PIX pixs) [static]

pixDilateGray3v()

Input: pixs (8 bpp, not cmapped) Return: pixd, or null on error

Notes: (1) Special case for vertical 1x3 brick Sel; also used as the second step for the 3x3 brick Sel.

PIX* pixErodeGray ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixErodeGray()

Input: pixs hsize (of Sel; must be odd; origin implicitly in center) vsize (ditto) Return: pixd

Notes: (1) Sel is a brick with all elements being hits (2) If hsize = vsize = 1, just returns a copy.

PIX* pixErodeGray3 ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixErodeGray3()

Input: pixs (8 bpp, not cmapped) hsize (1 or 3) vsize (1 or 3) Return: pixd, or null on error

Notes: (1) Special case for 1x3, 3x1 or 3x3 brick sel (all hits) (2) If hsize = vsize = 1, just returns a copy. (3) It would be nice not to add a border, but it is required if we want the same results as from the general case. We add 4 bytes on the left to speed up the copying, and 8 bytes at the right and bottom to allow unrolling of the computation of 8 pixels.

static PIX * pixErodeGray3h ( PIX pixs) [static]

pixErodeGray3h()

Input: pixs (8 bpp, not cmapped) Return: pixd, or null on error

Notes: (1) Special case for horizontal 3x1 brick Sel; also used as the first step for the 3x3 brick Sel.

static PIX * pixErodeGray3v ( PIX pixs) [static]

pixErodeGray3v()

Input: pixs (8 bpp, not cmapped) Return: pixd, or null on error

Notes: (1) Special case for vertical 1x3 brick Sel; also used as the second step for the 3x3 brick Sel. (2) Surprisingly, this is faster than setting up the lineptrs array and accessing into it; e.g., val4 = GET_DATA_BYTE(lines8[i + 3], j);

PIX* pixOpenGray ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixOpenGray()

Input: pixs hsize (of Sel; must be odd; origin implicitly in center) vsize (ditto) Return: pixd

Notes: (1) Sel is a brick with all elements being hits (2) If hsize = vsize = 1, just returns a copy.

PIX* pixOpenGray3 ( PIX pixs,
l_int32  hsize,
l_int32  vsize 
)

pixOpenGray3()

Input: pixs (8 bpp, not cmapped) hsize (1 or 3) vsize (1 or 3) Return: pixd, or null on error

Notes: (1) Special case for 1x3, 3x1 or 3x3 brick sel (all hits) (2) If hsize = vsize = 1, just returns a copy. (3) It would be nice not to add a border, but it is required to get the same results as for the general case.