Skip to content

label_to_regionlabel_to_regionLabelToRegionLabelToRegionlabel_to_regionlabel_to_region🔗

Short description🔗

label_to_regionlabel_to_regionLabelToRegionLabelToRegionlabel_to_regionlabel_to_region — Extract regions with equal gray values from an image.

Signature🔗

label_to_region( image LabelImage, out region Regions )label_to_region( LabelImage : Regions : : )void LabelToRegion( const HObject& LabelImage, HObject* Regions )static void HOperatorSet.LabelToRegion( HObject labelImage, out HObject regions )def label_to_region( label_image: HObject ) -> HObject

Herror label_to_region( const Hobject LabelImage, Hobject* Regions )

Herror T_label_to_region( const Hobject LabelImage, Hobject* Regions )

HRegion HImage::LabelToRegion( ) const

HRegion HImage.LabelToRegion( )

Description🔗

label_to_regionLabelToRegion segments an image into regions of equal gray value. One output region is generated for each gray value occurring in the image. This is similar to calling thresholdThreshold multiple times, and accumulating the results with concat_objConcatObj. Another related operator is regiongrowingRegiongrowing. However, label_to_regionLabelToRegion does not perform a connectionConnection operation on the resulting regions, i.e., they may be disconnected. A typical application of label_to_regionLabelToRegion is the segmentation of label images, hence its name.

The number of output regions is limited by the system parameter 'max_outp_obj_par'"max_outp_obj_par", which can be read via get_system(::'max_outp_obj_par':<number>).

Attention🔗

label_to_regionLabelToRegion is not implemented for images of type real. The input images must not contain negative gray values.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

LabelImagelabelImagelabel_image (input_object) singlechannelimage(-array) → object (byte / int2 / int4 / int8)object (byte / int2 / int4 / int8)HObject (byte / int2 / int4 / int8)HImage (byte / int2 / int4 / int8)HObject (byte / int2 / int4 / int8)Hobject (byte / int2 / int4 / int8)

Label image.

Regionsregionsregions (output_object) region-array → objectobjectHObjectHRegionHObjectHobject *

Regions having a constant gray value.

Complexity🔗

Let \(x1\) be the minimum x-coordinate, \(x2\) the maximum x-coordinate, \(y1\) be the minimum y-coordinate, and \(y2\) the maximum y-coordinate of a particular gray value. Furthermore, let \(N\) be the number of different gray values in the image. Then the runtime complexity is \(O(N * (x2 - x1 + 1) * (y2 - y1 + 1))\)

Result🔗

label_to_regionLabelToRegion returns 2 (H_MSG_TRUE) if the gray values lie within a correct range. 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", 'empty_region_result'"empty_region_result", and 'store_empty_region'"store_empty_region" with set_systemSetSystem. If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

min_max_grayMinMaxGray, sobel_ampSobelAmp, binomial_filterBinomialFilter, gauss_filterGaussFilter, reduce_domainReduceDomain, diff_of_gaussDiffOfGauss

Possible successors

connectionConnection, dilation1Dilation1, erosion1Erosion1, openingOpening, closingClosing, rank_regionRankRegion, shape_transShapeTrans, skeletonSkeleton

See also

thresholdThreshold, concat_objConcatObj, regiongrowingRegiongrowing, region_to_labelRegionToLabel

Module🔗

Foundation