min_max__ ( Regions, Image : : Percent : Min, Max, Range )

Determine the minimum and maximum gray values within regions.

The operator min_max__ creates the histogram of the absolute frequencies of the gray values within Regions in the input image Image (see histo__) and calculates the number of pixels Percent corresponding to the area of the input image. Then it goes inwards on both sides of the histogram by this number of pixels and determines the smallest and the largest gray value:

  e.g.:
    Area = 60, percent = 5, i.e. 3 pixels
    Histogram = [2,8,0,7,13,0,0,...,0,10,10,5,3,1,1]
    => Maximum = 255, Minimum = 0, Range = 255

    min_max__ returns: Maximum = 253, Minimum = 1, Range = 252
If Percent is set at 50, Min = Max = Median. If Percent is 0 no histogram is calculated in order to enhance the runtime.


Attention

In case of int2, int4- and real-images Percent has to be 0.


Parameters

Regions (input_object)
region(-array) -> object
Regions, the features of which are to be calculated.

Image (input_object)
image -> object : byte / int2 / int4 / real
Gray value image.

Percent (input_control)
number -> real / integer
Percentage below (above) the absolute maximum (minimum).
Default value: 0
Suggested values: 0, 1, 2, 5, 7, 10, 15, 20, 30, 40, 50
Restriction: (0 <= Percent) && (Percent <= 50)

Min (output_control)
real(-array) -> real
``Minimum'' gray value.

Max (output_control)
real(-array) -> real
``Maximum'' gray value.
Assertion: Max >= Min

Range (output_control)
real(-array) -> real
Difference between Max and Min.
Assertion: Range >= 0


Example
/* Threshold segmentation with training region: */
read_image(:Image:'fabrik':) >
draw_region(:Region::) >
min_max__(Region,Image::5:Min,Max,_) >
threshold__(Bild:Seg:Min,Max:) >
disp_region(Seg:::).

Complexity

If F is the area of the region the runtime complexity is O(F) if Percent = 0, O(F + 255) otherwise.


Result

The operator min_max__ returns the value TRUE if the input image has the defined gray values and the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator set_system(::'no_object_result',<Result>:). The behaviour in case of an empty region is set via the operator set_system(::'empty_region_result',<Result>:). If necessary an exception is raised.


Possible Predecessors

draw_region, circle, ellipse, rectangle1, threshold__, regiongrowing__


Possible Successors

threshold__


Alternatives

select_grey__, intensity__


See also

histo__, scale__, scale_max, learn_ndim1__



Copyright © 1996-1997 MVTec Software GmbH