Pink 0.9

watershedMeyer2lab.c File Reference

watershed transformation (Meyer's algorithm) with labelled markers More...


Detailed Description

watershed transformation (Meyer's algorithm) with labelled markers

Usage: watershedMeyer2lab marker image {roi|null} connex [mode] out

Description: Performs the watershed transformation on the image image, taking the set of markers in marker, in the form of a label image where all the pixels sharing the same label (even if not connected) belong to the same marker. If this parameter is present, roi indicates the region of interest on which the operation is performed. The parameter connex gives the adjacency relation (4,8 in 2D; 6,18,26 in 3D) for the makers.

The result is a label image. If the original markers are labelled by numbers 1,...,n then the regions (catchment basins) of the result will be labelled with the same numbers.

If the optional parameter mode is 0 (default value), then the separation (watershed) will be labelled with n+1. Otherwise, a separating point that is neighbour of exactly two regions i and j will be labelled by j*(n+1)+i, with i<j, and a separating point that is neighbour of more than two regions be labelled by n+1. Thus, from any label L > n+1, one can recover the labels of the two regions i,j in contact by doing: i = L%(n+1); j = L/(n+1).

Types supported: byte 2d, byte 3d

Category: connect

Author:
Michel Couprie