HALCON Reference Manual 10.0.2
Table of Contents / Regions / Features ClassesClassesClasses | | | Operators

spatial_relationT_spatial_relationspatial_relationSpatialRelationSpatialRelation (Operator)

Name

spatial_relationT_spatial_relationspatial_relationSpatialRelationSpatialRelation — Pose relation of regions with regard to the coordinate axes.

Signature

spatial_relation(Regions1, Regions2 : : Percent : RegionIndex1, RegionIndex2, Relation1, Relation2)

Herror T_spatial_relation(const Hobject Regions1, const Hobject Regions2, const Htuple Percent, Htuple* RegionIndex1, Htuple* RegionIndex2, Htuple* Relation1, Htuple* Relation2)

Herror spatial_relation(Hobject Regions1, Hobject Regions2, const HTuple& Percent, HTuple* RegionIndex1, HTuple* RegionIndex2, HTuple* Relation1, HTuple* Relation2)

HTuple HRegion::SpatialRelation(const HRegion& Regions2, const HTuple& Percent, HTuple* RegionIndex2, HTuple* Relation1, HTuple* Relation2) const

HTuple HRegionArray::SpatialRelation(const HRegionArray& Regions2, const HTuple& Percent, HTuple* RegionIndex2, HTuple* Relation1, HTuple* Relation2) const

void HOperatorSetX.SpatialRelation(
[in] IHUntypedObjectX* Regions1, [in] IHUntypedObjectX* Regions2, [in] VARIANT Percent, [out] VARIANT* RegionIndex1, [out] VARIANT* RegionIndex2, [out] VARIANT* Relation1, [out] VARIANT* Relation2)

VARIANT HRegionX.SpatialRelation(
[in] IHRegionX* Regions2, [in] Hlong Percent, [out] VARIANT* RegionIndex2, [out] VARIANT* Relation1, [out] VARIANT* Relation2)

static void HOperatorSet.SpatialRelation(HObject regions1, HObject regions2, HTuple percent, out HTuple regionIndex1, out HTuple regionIndex2, out HTuple relation1, out HTuple relation2)

HTuple HRegion.SpatialRelation(HRegion regions2, int percent, out HTuple regionIndex2, out HTuple relation1, out HTuple relation2)

Description

The operator spatial_relationspatial_relationspatial_relationSpatialRelationSpatialRelation selects regions located by PercentPercentPercentPercentpercent percent “left”, “right”, “above” or “below” other regions. Regions1Regions1Regions1Regions1regions1 and Regions2Regions2Regions2Regions2regions2 contain the regions to be compared. Regions1Regions1Regions1Regions1regions1 can have three states:

The percentage PercentPercentPercentPercentpercent is interpreted in such a way that the area of the second region has to be located really left/right or above/below the region margins of the first region by at least PercentPercentPercentPercentpercent percent. The indices of the regions that fulfill at least one of these conditions are then located at the n-th position in the output parameters RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1 and RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2. Additionally the output parameters Relation1Relation1Relation1Relation1relation1 and Relation2Relation2Relation2Relation2relation2 contain at the n-th position the type of relation of the region pair (RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1[n], RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2[n]), i.e., region with index RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2[n] has the relation Relation1Relation1Relation1Relation1relation1[n] and Relation2Relation2Relation2Relation2relation2[n] with region with index RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1[n].

Possible values for Relation1Relation1Relation1Relation1relation1 and Relation2Relation2Relation2Relation2relation2 are:

Relation1:

'left', 'right' or ”

Relation2:

'above', 'below' or ”

In RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1 and RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2 the indices of the regions in the tuples of the input regions (Regions1Regions1Regions1Regions1regions1 or Regions2Regions2Regions2Regions2regions2), respectively, are entered as image identifiers. Access to chosen regions via the index can be obtained by the operator copy_objcopy_objcopy_objCopyObjCopyObj.

Parallelization

Parameters

Regions1Regions1Regions1Regions1regions1 (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Starting regions.

Regions2Regions2Regions2Regions2regions2 (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Comparative regions.

PercentPercentPercentPercentpercent (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Percentage of the area of the comparative region which must be located left/right or above/below the region margins of the starting region.

Default value: 50

Suggested values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100

Typical range of values: 0 ≤ Percent Percent Percent Percent percent ≤ 100 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: (0 <= Percent) && (Percent <= 100)

RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1 (output_control)  integer-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Indices of the regions in the tuple of the input regions which fulfill the pose relation.

RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2 (output_control)  integer-array HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Indices of the regions in the tuple of the input regions which fulfill the pose relation.

Relation1Relation1Relation1Relation1relation1 (output_control)  string-array HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Horizontal pose relation in which RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2[n] stands with RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1[n].

Relation2Relation2Relation2Relation2relation2 (output_control)  string-array HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Vertical pose relation in which RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2[n] stands with RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1[n].

Result

The operator spatial_relationspatial_relationspatial_relationSpatialRelationSpatialRelation returns the value 2 (H_MSG_TRUE) if Regions2Regions2Regions2Regions2regions2 is not empty and PercentPercentPercentPercentpercent is correctly choosen. The behavior in case of empty parameter Regions2Regions2Regions2Regions2regions2 (no input regions available) is set via the operator set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). The behavior in case of empty region (the region is the empty set) is set via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdthresholdThresholdThreshold, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing, connectionconnectionconnectionConnectionConnection

Alternatives

area_centerarea_centerarea_centerAreaCenterAreaCenter, intersectionintersectionintersectionIntersectionIntersection

See also

select_region_spatialselect_region_spatialselect_region_spatialSelectRegionSpatialSelectRegionSpatial, find_neighborsfind_neighborsfind_neighborsFindNeighborsFindNeighbors, copy_objcopy_objcopy_objCopyObjCopyObj, obj_to_integerobj_to_integerobj_to_integerObjToIntegerObjToInteger

Module

Foundation


Table of Contents / Regions / Features ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH