spatial_relationT_spatial_relationSpatialRelationSpatialRelation (Operator)

Name

spatial_relationT_spatial_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)

void SpatialRelation(const HObject& Regions1, const HObject& Regions2, const HTuple& Percent, HTuple* RegionIndex1, HTuple* RegionIndex2, HTuple* Relation1, HTuple* Relation2)

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

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_relationSpatialRelationSpatialRelationSpatialRelation 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_objCopyObjCopyObjCopyObj.

Execution Information

Parameters

Regions1Regions1Regions1Regions1regions1 (input_object)  region(-array) objectHRegionHRegionHobject

Starting regions.

Regions2Regions2Regions2Regions2regions2 (input_object)  region(-array) objectHRegionHRegionHobject

Comparative regions.

PercentPercentPercentPercentpercent (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (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 HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

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

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

Relation1Relation1Relation1Relation1relation1 (output_control)  string-array HTupleHTupleHtuple (string) (string) (HString) (char*)

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

Relation2Relation2Relation2Relation2relation2 (output_control)  string-array HTupleHTupleHtuple (string) (string) (HString) (char*)

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

Result

The operator spatial_relationspatial_relationSpatialRelationSpatialRelationSpatialRelation 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>)SetSystem("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>)SetSystem("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_centerAreaCenterAreaCenterAreaCenter, intersectionintersectionIntersectionIntersectionIntersection

See also

select_region_spatialselect_region_spatialSelectRegionSpatialSelectRegionSpatialSelectRegionSpatial, find_neighborsfind_neighborsFindNeighborsFindNeighborsFindNeighbors, copy_objcopy_objCopyObjCopyObjCopyObj, obj_to_integerobj_to_integerObjToIntegerObjToIntegerObjToInteger

Module

Foundation