Hamming distance between two regions.
The operator ::hamming_distance returns the hamming distance between two regions, i.e. the number of pixels of the regions which are different (Distance), i.e. the number of pixels contained in one region but not in the other:
Distance = |Regions1 intersection ~Regions2| +
|Regions2 intersection ~Regions1|
The parameter Similarity describes the similarity between the
two regions based on the hamming distance Distance:
Similarity = ( 1 - Distance ) / ( |Regions1| + |Regions2| )
If both regions are empty Similarity is set to 0.
The regions with the same index from both input parameters are
always compared.
In both input parameters the same number of regions must be passed.
|
Regions1 (input_object) |
region(-array) -> Hobject: HRegion(Array) |
| Regions to be examined. | |
|
Regions2 (input_object) |
region(-array) -> Hobject: HRegion(Array) |
| Comparative regions. | |
|
Distance (output_control) |
integer(-array) -> (HTuple.) long * |
| Hamming distance of two regions. | |
| Assertion: Distance >= 0 | |
|
Similarity (output_control) |
real(-array) -> (HTuple.) double * |
| Similarity of two regions. | |
| Assertion: (0 <= Similarity) && (Similarity <= 1) | |
If F is the area of a region the mean runtime complexity is O(F).
hamming_distance returns the value H_MSG_TRUE if the number of objects in both parameters is the same and is not 0. The behavior in case of empty input (no input objects 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 handling handling is raised.
::threshold, ::regiongrowing, ::connection
::intersection, ::complement, ::area_center
Region processing