Skip to content

background_segBackgroundSegBackgroundSegbackground_segbackground_seg🔗

Short description🔗

background_segBackgroundSegBackgroundSegbackground_segbackground_seg — Determine the connected components of the background of given regions.

Signature🔗

background_seg( region Foreground, out region BackgroundRegions )void BackgroundSeg( const HObject& Foreground, HObject* BackgroundRegions )static void HOperatorSet.BackgroundSeg( HObject foreground, out HObject backgroundRegions )def background_seg( foreground: HObject ) -> HObject

Herror background_seg( const Hobject Foreground, Hobject* BackgroundRegions )

Herror T_background_seg( const Hobject Foreground, Hobject* BackgroundRegions )

HRegion HRegion::BackgroundSeg( ) const

HRegion HRegion.BackgroundSeg( )

Description🔗

background_segBackgroundSeg determines connected components of the background of the foreground regions given in Foregroundforegroundforeground. This operator is normally used after an edge operator in order to determine the regions enclosed by the extracted edges. The connected components are determined using 4-neighborhood.

Execution information🔗

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

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

  • Processed without parallelization.

Parameters🔗

Foregroundforegroundforeground (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Input regions.

BackgroundRegionsbackgroundRegionsbackground_regions (output_object) region-array → objectHObjectHRegionHObjectHobject *

Connected components of the background.

Example🔗

(HDevelop)

* Simulation of background_seg:
background_seg(Foreground,BackgroundRegions)
  complement(Foreground,Background)
  get_system('neighborhood',Save)
  set_system('neighborhood',4)
  connection(Background,BackgroundRegions)
  set_system('neighborhood',Save)

* Segmentation with edge filter:
read_image(Image,'fabrik')
sobel_dir(Image,Sobel,Dir,'sum_sqrt',3)
threshold(Sobel,Edges,20,255)
skeleton(Edges,Margins)
background_seg(Margins,Regions)
(C)
/* Segmentation with edge filter: */
read_image(&Image,"fabrik")\;
sobel_dir(Image,&Sobel,&Dir,"sum_sqrt",3)\;
threshold(Sobel,&Edges,20,255)\;
skeleton(Edges,&Margins)\;
background_seg(Margins,&Regions)\;

Complexity🔗

Let \(F\) be the area of the background, \(H\) and \(W\) be the height and width of the image, and \(N\) be the number of resulting regions. Then the runtime complexity is \(O(H + \sqrt{F} * \sqrt{N})\).

Result🔗

background_segBackgroundSeg always returns the value 2 (H_MSG_TRUE). The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>) and the behavior in case of an empty input region via set_system('empty_region_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection, regiongrowingRegiongrowing, pouringPouring, class_ndim_normClassNdimNorm

Possible successors

select_shapeSelectShape

Alternatives

complementComplement, connectionConnection

See also

thresholdThreshold, hysteresis_thresholdHysteresisThreshold, skeletonSkeleton, expand_regionExpandRegion, set_systemSetSystem, sobel_ampSobelAmp, edges_imageEdgesImage, robertsRoberts, bandpass_imageBandpassImage

Module🔗

Foundation