regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing (Operator)

Name

regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing — Segment an image using regiongrowing.

Signature

regiongrowing(Image : Regions : RasterHeight, RasterWidth, Tolerance, MinSize : )

Herror regiongrowing(const Hobject Image, Hobject* Regions, const Hlong RasterHeight, const Hlong RasterWidth, double Tolerance, const Hlong MinSize)

Herror T_regiongrowing(const Hobject Image, Hobject* Regions, const Htuple RasterHeight, const Htuple RasterWidth, const Htuple Tolerance, const Htuple MinSize)

void Regiongrowing(const HObject& Image, HObject* Regions, const HTuple& RasterHeight, const HTuple& RasterWidth, const HTuple& Tolerance, const HTuple& MinSize)

HRegion HImage::Regiongrowing(Hlong RasterHeight, Hlong RasterWidth, const HTuple& Tolerance, Hlong MinSize) const

HRegion HImage::Regiongrowing(Hlong RasterHeight, Hlong RasterWidth, double Tolerance, Hlong MinSize) const

static void HOperatorSet.Regiongrowing(HObject image, out HObject regions, HTuple rasterHeight, HTuple rasterWidth, HTuple tolerance, HTuple minSize)

HRegion HImage.Regiongrowing(int rasterHeight, int rasterWidth, HTuple tolerance, int minSize)

HRegion HImage.Regiongrowing(int rasterHeight, int rasterWidth, double tolerance, int minSize)

def regiongrowing(image: HObject, raster_height: int, raster_width: int, tolerance: Union[int, float], min_size: int) -> HObject

Description

regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing segments images into regions of the same intensity - rastered into rectangles of size RasterHeightRasterHeightRasterHeightRasterHeightrasterHeightraster_height RasterWidthRasterWidthRasterWidthRasterWidthrasterWidthraster_width. In order to decide whether two adjacent rectangles belong to the same region only the gray value of their center points is used. If the gray value difference is less then or equal to ToleranceToleranceToleranceTolerancetolerancetolerance the rectangles are merged into one region.

If and are two gray values to be examined, they are merged into the same region if: For images of type 'cyclic', the following formulas are used:

For rectangles larger than one pixel, usually the images should be smoothed with a lowpass filter with a size of at least RasterHeightRasterHeightRasterHeightRasterHeightrasterHeightraster_height RasterWidthRasterWidthRasterWidthRasterWidthrasterWidthraster_width before calling regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing (so that the gray values at the centers of the rectangles are “representative” for the whole rectangle). If the image contains little noise and the rectangles are small, the smoothing can be omitted in many cases.

The resulting regions are collections of rectangles of the chosen size RasterHeightRasterHeightRasterHeightRasterHeightrasterHeightraster_height RasterWidthRasterWidthRasterWidthRasterWidthrasterWidthraster_width. Only regions containing at least MinSizeMinSizeMinSizeMinSizeminSizemin_size points are returned.

Regiongrowing is a very fast operation, and thus suited for time-critical applications.

Attention

RasterWidthRasterWidthRasterWidthRasterWidthrasterWidthraster_width and RasterHeightRasterHeightRasterHeightRasterHeightrasterHeightraster_height are automatically converted to odd values if necessary.

Execution Information

Parameters

ImageImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte / direction / cyclic / int1 / int2 / int4 / real)

Input image.

RegionsRegionsRegionsRegionsregionsregions (output_object)  region-array objectHRegionHObjectHRegionHobject *

Segmented regions.

RasterHeightRasterHeightRasterHeightRasterHeightrasterHeightraster_height (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Vertical distance between tested pixels (height of the raster).

Default: 3

Suggested values: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21

Value range: 1 ≤ RasterHeight RasterHeight RasterHeight RasterHeight rasterHeight raster_height ≤ 99 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: RasterHeight >= 1 && odd(RasterHeight)

RasterWidthRasterWidthRasterWidthRasterWidthrasterWidthraster_width (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Horizontal distance between tested pixels (height of the raster).

Default: 3

Suggested values: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21

Value range: 1 ≤ RasterWidth RasterWidth RasterWidth RasterWidth rasterWidth raster_width ≤ 99 (lin)

Minimum increment: 2

Recommended increment: 2

Restriction: RasterWidth >= 1 && odd(RasterWidth)

ToleranceToleranceToleranceTolerancetolerancetolerance (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Points with a gray value difference less then or equal to tolerance are accumulated into the same object.

Default: 6.0

Suggested values: 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 18.0, 25.0

Value range: 0 ≤ Tolerance Tolerance Tolerance Tolerance tolerance tolerance (lin)

Minimum increment: 0.01

Recommended increment: 1.0

MinSizeMinSizeMinSizeMinSizeminSizemin_size (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum size of the output regions.

Default: 100

Suggested values: 1, 5, 10, 20, 50, 100, 200, 500, 1000

Value range: 1 ≤ MinSize MinSize MinSize MinSize minSize min_size

Minimum increment: 1

Recommended increment: 5

Example (HDevelop)

read_image(Image,'fabrik')
mean_image(Image,Mean,RasterHeight,RasterWidth)
regiongrowing(Mean,Result,RasterHeight,RasterWidth,6.0,100)

Example (C)

read_image(&Image,"fabrik");
mean_image(Image,&Mean,RasterHeight,RasterWidth);
regiongrowing(Mean,&Result,RasterHeight,RasterWidth,6,100);

Example (HDevelop)

read_image(Image,'fabrik')
mean_image(Image,Mean,RasterHeight,RasterWidth)
regiongrowing(Mean,Result,RasterHeight,RasterWidth,6.0,100)

Example (HDevelop)

read_image(Image,'fabrik')
mean_image(Image,Mean,RasterHeight,RasterWidth)
regiongrowing(Mean,Result,RasterHeight,RasterWidth,6.0,100)

Example (HDevelop)

read_image(Image,'fabrik')
mean_image(Image,Mean,RasterHeight,RasterWidth)
regiongrowing(Mean,Result,RasterHeight,RasterWidth,6.0,100)

Complexity

Let N be the number of found regions and M the number of points in one of these regions. Then the runtime complexity is O(N * log(M) * M).

Result

regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing returns 2 ( H_MSG_TRUE) if all parameters are correct. The behavior with respect to the input images and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result""empty_region_result", and 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemSetSystemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

binomial_filterbinomial_filterBinomialFilterBinomialFilterBinomialFilterbinomial_filter, mean_imagemean_imageMeanImageMeanImageMeanImagemean_image, gauss_filtergauss_filterGaussFilterGaussFilterGaussFiltergauss_filter, smooth_imagesmooth_imageSmoothImageSmoothImageSmoothImagesmooth_image, median_imagemedian_imageMedianImageMedianImageMedianImagemedian_image, anisotropic_diffusionanisotropic_diffusionAnisotropicDiffusionAnisotropicDiffusionAnisotropicDiffusionanisotropic_diffusion

Possible Successors

select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_grayselect_graySelectGraySelectGraySelectGrayselect_gray

Alternatives

regiongrowing_nregiongrowing_nRegiongrowingNRegiongrowingNRegiongrowingNregiongrowing_n, regiongrowing_meanregiongrowing_meanRegiongrowingMeanRegiongrowingMeanRegiongrowingMeanregiongrowing_mean, label_to_regionlabel_to_regionLabelToRegionLabelToRegionLabelToRegionlabel_to_region

Module

Foundation