Классы |
struct | L_NewPixel |
struct | L_WSPixel |
Макросы |
#define | DEBUG_WATERSHED 0 |
Определения типов |
typedef struct L_NewPixel | L_NEWPIXEL |
typedef struct L_WSPixel | L_WSPIXEL |
Функции |
static void | wshedSaveBasin (L_WSHED *wshed, l_int32 index, l_int32 level) |
static l_int32 | identifyWatershedBasin (L_WSHED *wshed, l_int32 index, l_int32 level, BOX **pbox, PIX **ppixd) |
static l_int32 | mergeLookup (L_WSHED *wshed, l_int32 sindex, l_int32 dindex) |
static l_int32 | wshedGetHeight (L_WSHED *wshed, l_int32 val, l_int32 label, l_int32 *pheight) |
static void | pushNewPixel (L_QUEUE *lq, l_int32 x, l_int32 y, l_int32 *pminx, l_int32 *pmaxx, l_int32 *pminy, l_int32 *pmaxy) |
static void | popNewPixel (L_QUEUE *lq, l_int32 *px, l_int32 *py) |
static void | pushWSPixel (L_HEAP *lh, L_STACK *stack, l_int32 val, l_int32 x, l_int32 y, l_int32 index) |
static void | popWSPixel (L_HEAP *lh, L_STACK *stack, l_int32 *pval, l_int32 *px, l_int32 *py, l_int32 *pindex) |
static void | debugPrintLUT (l_int32 *lut, l_int32 size, l_int32 debug) |
static void | debugWshedMerge (L_WSHED *wshed, char *descr, l_int32 x, l_int32 y, l_int32 label, l_int32 index) |
L_WSHED * | wshedCreate (PIX *pixs, PIX *pixm, l_int32 mindepth, l_int32 debugflag) |
void | wshedDestroy (L_WSHED **pwshed) |
l_int32 | wshedApply (L_WSHED *wshed) |
l_int32 | wshedBasins (L_WSHED *wshed, PIXA **ppixa, NUMA **pnalevels) |
PIX * | wshedRenderFill (L_WSHED *wshed) |
PIX * | wshedRenderColors (L_WSHED *wshed) |
Переменные |
static const l_uint32 | MAX_LABEL_VALUE = 0x7fffffff |
identifyWatershedBasin()
Input: wshed index (index of basin to be located) level (of basin at point at which the two basins met) &box (<return> bounding box of basin) &pixd (<return> pix of basin, cropped to its bounding box) Return: 0 if OK, 1 on error
Notes: (1) This is a static function, so we assume pixlab, pixs and pixt exist and are the same size. (2) It selects all pixels that have the label in pixlab and that have a value in pixs that is less than . (3) It is used whenever two seeded basins meet (typically at a saddle), or when one seeded basin meets a 'filler'. All identified basins are saved as a watershed.
mergeLookup()
Input: wshed sindex (primary index being changed in the merge) dindex (index that will point to after the merge) Return: 0 if OK, 1 on error
Notes: (1) The links are a sparse array of Numas showing current back-links. The lut gives the current index (of the seed or the minima for the wshed in which it is located. (2) Think of each entry in the lut. There are two types: owner: lut[index] = index redirect: lut[index] != index (3) This is called each time a merge occurs. It puts the lut and backlinks in a canonical form after the merge, where all entries in the lut point to the current "owner", which has all backlinks. That is, every "redirect" in the lut points to an "owner". The lut always gives the index of the current owner.
wshedCreate()
Input: pixs (8 bpp source) pixm (1 bpp 'marker' seed) mindepth (minimum depth; anything less is not saved) debugflag (1 for debug output) Return: WShed, or null on error
Notes: (1) It is not necessary for the fg pixels in the seed image be at minima, or that they be isolated. We extract a single pixel from each connected component, and a seed anywhere in a watershed will eventually label the watershed when the filling level reaches it. (2) Set mindepth to some value to ignore noise in pixs that can create small local minima. Any watershed shallower than mindepth, even if it has a seed, will not be saved; It will either be incorporated in another watershed or eliminated.