spatial_relation๐
Short description๐
spatial_relation โ Pose relation of regions with regard to ย the coordinate axes.
Signature๐
spatial_relation( region Regions1, region Regions2, integer Percent, out integer RegionIndex1, out integer RegionIndex2, out string Relation1, out string Relation2 )
Description๐
The operator spatial_relation selects regions located by
Percent percent โleftโ, โrightโ, โaboveโ or โbelowโ
other regions.
Regions1 and Regions2 contain the regions
to be compared.
Regions1 can have three states:
-
Regions1contains an empty object tuple, i.e.,count_objreturns 0:In this case all regions in
Regions2are permutatively checked for neighborhood. -
Regions1consists of one region:The regions of
Regions1are compared to all regions inRegions2. -
Regions1consists of the same number of regions asRegions2:Regions1andRegions2are checked for a neighboring relation.
The percentage Percent 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
Percent 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
RegionIndex1 and RegionIndex2.
Additionally the output parameters Relation1 and
Relation2 contain at the n-th position the type of relation of the
region pair (RegionIndex1[n], RegionIndex2[n]),
i.e., region with index RegionIndex2[n] has the relation
Relation1[n] and Relation2[n] with region with
index RegionIndex1[n].
Possible values for Relation1 and Relation2 are:
In RegionIndex1 and RegionIndex2 the indices of the
regions in the tuples of the input regions (Regions1 or
Regions2), respectively, are entered as image identifiers.
Access to chosen regions via the index can be obtained by the operator
copy_obj.
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๐
Regions1 (input_object) region(-array) โ object
Starting regions.
Regions2 (input_object) region(-array) โ object
Comparative regions.
Percent (input_control) integer โ (integer)
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 โค 100 (lin)
Minimum increment: 1
Recommended increment: 10
RegionIndex1 (output_control) integer-array โ (integer)
Indices of the regions in the tuple of the input regions which fulfill the pose relation.
RegionIndex2 (output_control) integer-array โ (integer)
Indices of the regions in the tuple of the input regions which fulfill the pose relation.
Relation1 (output_control) string-array โ (string)
Vertical pose relation in which
RegionIndex2[n] stands with
RegionIndex1[n].
Relation2 (output_control) string-array โ (string)
Horizontal pose relation in which RegionIndex2[n]
stands with RegionIndex1[n].
Result๐
The operator spatial_relation returns the value 2 (H_MSG_TRUE) if
Regions2 is not empty and Percent is correctly
chosen. The behavior in case of empty parameter Regions2
(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
set_system('empty_region_result',<Result>).
If necessary an exception is raised.
Combinations with other operators๐
Combinations
Possible predecessors
threshold, regiongrowing, connection
Alternatives
See also
select_region_spatial, find_neighbors, copy_obj, obj_to_integer
Module๐
Foundation