distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMin (Operator)


distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMin — Minimum distance between the contour pixels of two regions each.


distance_rr_min(Regions1, Regions2 : : : MinDistance, Row1, Column1, Row2, Column2)

Herror distance_rr_min(const Hobject Regions1, const Hobject Regions2, double* MinDistance, Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2)

Herror T_distance_rr_min(const Hobject Regions1, const Hobject Regions2, Htuple* MinDistance, Htuple* Row1, Htuple* Column1, Htuple* Row2, Htuple* Column2)

void DistanceRrMin(const HObject& Regions1, const HObject& Regions2, HTuple* MinDistance, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2)

HTuple HRegion::DistanceRrMin(const HRegion& Regions2, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2) const

double HRegion::DistanceRrMin(const HRegion& Regions2, Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2) const

static void HOperatorSet.DistanceRrMin(HObject regions1, HObject regions2, out HTuple minDistance, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2)

HTuple HRegion.DistanceRrMin(HRegion regions2, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2)

double HRegion.DistanceRrMin(HRegion regions2, out int row1, out int column1, out int row2, out int column2)


The operator distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMinDistanceRrMin calculates the minimum distance of pairs of regions. If several regions are passed in Regions1Regions1Regions1Regions1regions1 and Regions2Regions2Regions2Regions2regions2 the distance between the contour pixels of each i-th element is calculated and then forms the i-th entry in the output parameter MinDistanceMinDistanceMinDistanceMinDistanceminDistance. The Euclidean distance is used. The parameters (Row1Row1Row1Row1row1, Column1Column1Column1Column1column1) and (Row2Row2Row2Row2row2, Column2Column2Column2Column2column2) indicate the position on the contour of Regions1Regions1Regions1Regions1regions1 and Regions2Regions2Regions2Regions2regions2, respectively, that have the minimum distance.

The calculation is carried out by comparing all contour pixels (see get_region_contourget_region_contourGetRegionContourGetRegionContourGetRegionContour). This means in particular that holes in the regions are ignored. Furthermore, it is not checked whether one region lies completely within the other region. In this case, a minimum distance > 0 is returned. It is also not checked whether both regions contain a nonempty intersection. In the latter case, a minimum distance of 0 or > 0 can be returned, depending on whether the contours of the regions contain a common point or not.


Both input parameters must contain the same number of regions. The regions must not be empty.

Execution Information


Regions1Regions1Regions1Regions1regions1 (input_object)  region(-array) objectHRegionHRegionHobject

Regions to be examined.

Regions2Regions2Regions2Regions2regions2 (input_object)  region(-array) objectHRegionHRegionHobject

Regions to be examined.

MinDistanceMinDistanceMinDistanceMinDistanceminDistance (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Minimum distance between contours of the regions.

Assertion: 0 <= MinDistance

Row1Row1Row1Row1row1 (output_control)  point.y(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Line index on contour in Regions1Regions1Regions1Regions1regions1.

Column1Column1Column1Column1column1 (output_control)  point.x(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index on contour in Regions1Regions1Regions1Regions1regions1.

Row2Row2Row2Row2row2 (output_control)  point.y(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Line index on contour in Regions2Regions2Regions2Regions2regions2.

Column2Column2Column2Column2column2 (output_control)  point.x(-array) HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index on contour in Regions2Regions2Regions2Regions2regions2.


If N1,N2 are the lengths of the contours the runtime complexity is O(N1 * N2).


The operator distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMinDistanceRrMin returns the value 2 (H_MSG_TRUE) if the input is not empty. Otherwise an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdThreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowing, connectionconnectionConnectionConnectionConnection


distance_rr_min_dildistance_rr_min_dilDistanceRrMinDilDistanceRrMinDilDistanceRrMinDil, dilation1dilation1Dilation1Dilation1Dilation1, intersectionintersectionIntersectionIntersectionIntersection