Herror ::distance_pr (
    Hobject Region,
    const HTuple &Row,
    const HTuple &Column,
    double *DistanceMin,
    double *DistanceMax
)
Herror ::distance_pr (
    Hobject Region,
    const HTuple &Row,
    const HTuple &Column,
    HTuple *DistanceMin,
    HTuple *DistanceMax
)
HTuple HRegion::DistancePr (
    const HTuple &Row,
    const HTuple &Column,
    HTuple *DistanceMax
) const

Calculate the distance between one point and one region.

The operator ::distance_pr calculates the distance between one point and one region. As input the column und Row of the point (Row,Column) and one region are expected. If the pint is inside the region the minimal distance is zero. The parameters DistanceMin and DistanceMax return the result of the calculation.


Parameters

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

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

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

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

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


Example
dev_close_window ()
read_image (Image, 'mreut')
dev_open_window (0, 0, 512, 512, 'white', WindowHandle)
dev_set_color ('black')
threshold (Image, Region, 180, 255)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 
              10000, 100000000)
Row1 := 255
Column1 := 255
dev_clear_window ()
dev_display (SelectedRegions)
dev_set_color ('red')
for i := 1 to 360 by 1
  Row2 := 255 + sin(rad(i)) * 200
  Column2 := 255 + cos(rad(i)) * 200
  disp_line (WindowHandle, Row1, Column1, Row2, Column2)
  distance_pr (SelectedRegions, Row2, Column2, 
               DistanceMin, DistanceMax)
endfor

Result

::distance_pr returns H_MSG_TRUE.


Alternatives

::distance_lr, ::distance_sr, ::diameter_region


See also

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


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH