Herror ::distance_sr (
    Hobject Region,
    const HTuple &Row1,
    const HTuple &Column1,
    const HTuple &Row2,
    const HTuple &Column2,
    double *DistanceMin,
    double *DistanceMax
)
Herror ::distance_sr (
    Hobject Region,
    const HTuple &Row1,
    const HTuple &Column1,
    const HTuple &Row2,
    const HTuple &Column2,
    HTuple *DistanceMin,
    HTuple *DistanceMax
)
HTuple HRegion::DistanceSr (
    const HTuple &Row1,
    const HTuple &Column1,
    const HTuple &Row2,
    const HTuple &Column2,
    HTuple *DistanceMax
) const

Calculate the distance between one line segment and one region.

The operator ::distance_sr calculates the distance between one line segment and one region. Row1, Column1, Row2, Column2 are the the initial and end coordinates of the line segment. The parameters DistanceMin and DistanceMax contain the resulting distances.


Attention

Due to efficiency of ::distance_sr holes are ignored. Furthermore, if the lines intersects the region a minimal distance larger than 0.5 can be returned.


Parameters

Region (input_object)
region -> Hobject: HRegion
Input region.

Row1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the line segment.

Column1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the line segment.

Row2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the line segment.

Column2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the line segment.

DistanceMin (output_control)
number(-array) -> (HTuple.) double *
Minimal distance between the line segment and the region

DistanceMax (output_control)
number(-array) -> (HTuple.) double *
Maximal distance between the line segment and the region


Example
threshold(Image, &Region, 0.0, 120.0);
distance_sr(Region,row1,column1,row2,column2
            &distance_min, &distance_max);

Result

::distance_sr returns H_MSG_TRUE.


Alternatives

::distance_lr, ::distance_pr, ::diameter_region


See also

::hamming_distance, ::select_region_point, ::test_region_point, ::smallest_rectangle2


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH