Skip to content

get_region_chainGetRegionChainGetRegionChainget_region_chainT_get_region_chainπŸ”—

Short descriptionπŸ”—

get_region_chainGetRegionChainGetRegionChainget_region_chainT_get_region_chain β€” Contour of an object as chain code.

WarningπŸ”—

get_region_chainGetRegionChain is obsolete and is only provided for reasons of backward compatibility.

SignatureπŸ”—

get_region_chain( region Region, out chain.begin.y Row, out chain.begin.x Column, out chain.code Chain )void GetRegionChain( const HObject& Region, HTuple* Row, HTuple* Column, HTuple* Chain )static void HOperatorSet.GetRegionChain( HObject region, out HTuple row, out HTuple column, out HTuple chain )def get_region_chain( region: HObject ) -> Tuple[int, int, Sequence[int]]

Herror T_get_region_chain( const Hobject Region, Htuple* Row, Htuple* Column, Htuple* Chain )

void HRegion::GetRegionChain( Hlong* Row, Hlong* Column, HTuple* Chain ) const

void HRegion.GetRegionChain( out int row, out int column, out HTuple chain )

DescriptionπŸ”—

The operator get_region_chainGetRegionChain returns the contour of a region. A contour is a series of pixels describing the outline of the region. The contour β€œlies on” the region. It starts at the smallest line number; in that line at the pixel with the largest column index. The rotation occurs clockwise. Holes of the region are ignored. The direction code (chain code) is defined as follows:

                          3       2       1
                          4       *       0
                          5       6       7

The operator get_region_chainGetRegionChain returns the code in the form of a tuple. In case of an empty region the parameters Rowrowrow and Columncolumncolumn are zero and Chainchainchain is the empty tuple.

AttentionπŸ”—

Holes of the region are ignored. Only one region may be passed, and it must have exactly one connection component.

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πŸ”—

Regionregionregion (input_object) region β†’ objectHObjectHRegionHObjectHobject

Region to be transformed.

Rowrowrow (output_control) chain.begin.y β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Line of starting point.

Columncolumncolumn (output_control) chain.begin.x β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column of starting point.

Chainchainchain (output_control) chain.code-array β†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Direction code of the contour (from starting point).

Value range: 0 ≀ Chain ≀ 7

ResultπŸ”—

The operator get_region_chainGetRegionChain normally returns the value 2 (H_MSG_TRUE). If more than one connection component is passed an exception is raised. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>). The behavior in case of empty region (the region is the empty set) is set via the operator set_system('empty_region_result',<Result>). If necessary an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

sobel_ampSobelAmp, thresholdThreshold, skeletonSkeleton, edges_imageEdgesImage, gen_rectangle1GenRectangle1, gen_circleGenCircle

Possible successors

approx_chainApproxChain, approx_chain_simpleApproxChainSimple

See also

copy_objCopyObj, get_region_contourGetRegionContour, get_region_polygonGetRegionPolygon

ModuleπŸ”—

Foundation