spatial_relationT_spatial_relationSpatialRelationSpatialRelationspatial_relation (Operator)

Name

spatial_relationT_spatial_relationSpatialRelationSpatialRelationspatial_relation — 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)

def spatial_relation(regions_1: HObject, regions_2: HObject, percent: int) -> Tuple[Sequence[int], Sequence[int], Sequence[str], Sequence[str]]

Description

The operator spatial_relationspatial_relationSpatialRelationSpatialRelationSpatialRelationspatial_relation selects regions located by PercentPercentPercentPercentpercentpercent percent “left”, “right”, “above” or “below” other regions. Regions1Regions1Regions1Regions1regions1regions_1 and Regions2Regions2Regions2Regions2regions2regions_2 contain the regions to be compared. Regions1Regions1Regions1Regions1regions1regions_1 can have three states:

The percentage PercentPercentPercentPercentpercentpercent 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 PercentPercentPercentPercentpercentpercent 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 RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1 and RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2. Additionally the output parameters Relation1Relation1Relation1Relation1relation1relation_1 and Relation2Relation2Relation2Relation2relation2relation_2 contain at the n-th position the type of relation of the region pair (RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1[n], RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2[n]), i.e., region with index RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2[n] has the relation Relation1Relation1Relation1Relation1relation1relation_1[n] and Relation2Relation2Relation2Relation2relation2relation_2[n] with region with index RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1[n].

Possible values for Relation1Relation1Relation1Relation1relation1relation_1 and Relation2Relation2Relation2Relation2relation2relation_2 are:

In RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1 and RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2 the indices of the regions in the tuples of the input regions (Regions1Regions1Regions1Regions1regions1regions_1 or Regions2Regions2Regions2Regions2regions2regions_2), respectively, are entered as image identifiers. Access to chosen regions via the index can be obtained by the operator copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj.

Execution Information

Parameters

Regions1Regions1Regions1Regions1regions1regions_1 (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Starting regions.

Regions2Regions2Regions2Regions2regions2regions_2 (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Comparative regions.

PercentPercentPercentPercentpercentpercent (input_control)  integer HTupleintHTupleHtuple (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: 50

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

Value range: 0 ≤ Percent Percent Percent Percent percent percent ≤ 100 (lin)

Minimum increment: 1

Recommended increment: 10

RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1 (output_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2 (output_control)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Relation1Relation1Relation1Relation1relation1relation_1 (output_control)  string-array HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Horizontal pose relation in which RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2[n] stands with RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1[n].

Relation2Relation2Relation2Relation2relation2relation_2 (output_control)  string-array HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Vertical pose relation in which RegionIndex2RegionIndex2RegionIndex2RegionIndex2regionIndex2region_index_2[n] stands with RegionIndex1RegionIndex1RegionIndex1RegionIndex1regionIndex1region_index_1[n].

Result

The operator spatial_relationspatial_relationSpatialRelationSpatialRelationSpatialRelationspatial_relation returns the value 2 ( H_MSG_TRUE) if Regions2Regions2Regions2Regions2regions2regions_2 is not empty and PercentPercentPercentPercentpercentpercent is correctly chosen. The behavior in case of empty parameter Regions2Regions2Regions2Regions2regions2regions_2 (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>)set_system("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>)set_system("empty_region_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection

Alternatives

area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, intersectionintersectionIntersectionIntersectionIntersectionintersection

See also

select_region_spatialselect_region_spatialSelectRegionSpatialSelectRegionSpatialSelectRegionSpatialselect_region_spatial, find_neighborsfind_neighborsFindNeighborsFindNeighborsFindNeighborsfind_neighbors, copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj, obj_to_integerobj_to_integerObjToIntegerObjToIntegerObjToIntegerobj_to_integer

Module

Foundation