midrange_imageπ
Short descriptionπ
midrange_image β Calculate the average of maximum and minimum inside any mask.
Signatureπ
midrange_image( image Image, region Mask, out image ImageMidrange, string Margin )
Descriptionπ
The operator midrange_image forms the average of maximum and
minimum inside the indicated mask in the whole image. Several
border treatments (Margin) can be chosen for filtering:
-
gray value Pixels outside of the image border are assumed to be constant (with the indicated gray value).
-
'continued' Continuation of the gray values at the image border.
-
'cyclic' Cyclic continuation at the image borders.
-
'mirrored' Reflection of pixels at the image borders.
The indicated mask (= region of the mask image) is put over the image to be filtered in such a way that the center of the mask touches all pixels once.
For an explanation of the concept of smoothing filters see the introduction of chapter Filters / Smoothing.
Attentionπ
Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.
Execution informationπ
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Automatically parallelized on domain level.
Parametersπ
Image (input_object) (multichannel-)image(-array) β object (byte / int2 / uint2 / int4 / real)
Image to be filtered.
Mask (input_object) region β object
Filter mask.
ImageMidrange (output_object) (multichannel-)image(-array) β object (byte / int2 / uint2 / int4 / real)
Filtered image.
Margin (input_control) string β (string / integer / real)
Border treatment.
Default: 'mirrored'
Suggested values: 'mirrored', 'cyclic', 'continued', 0, 30, 60, 90, 120, 150, 180, 210, 240, 255
Exampleπ
(HDevelop)
read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
midrange_image(Image,Region,Midrange,'mirrored')
dev_display(Midrange)
read_image(&Image,"fabrik")\;
draw_region(&Region,WindowHandle)\;
midrange_image(Image,Region,&Midrange,"mirrored")\;
disp_image(Midrange,WindowHandle)\;
Complexityπ
For each pixel: \(O(\sqrt{F} * 5)\) with F = area of Mask.
Resultπ
If the parameter values are correct the operator
midrange_image returns the value 2 (H_MSG_TRUE). The behavior in case
of empty input (no input images available) is set via the operator
set_system('no_object_result',<Result>).
If necessary an exception is raised.
Combinations with other operatorsπ
Combinations
Possible predecessors
read_image, draw_region, gen_circle, gen_rectangle1
Possible successors
threshold, dyn_threshold, regiongrowing
Alternatives
See also
gen_circle, gen_rectangle1, gray_erosion_rect, gray_dilation_rect, gray_range_rect
Referencesπ
R. Haralick, L. Shapiro; βComputer and Robot Visionβ; Addison-Wesley, 1992, Seite 319
Moduleπ
Foundation