Skip to content

midrange_imageMidrangeImageMidrangeImagemidrange_imagemidrange_imageπŸ”—

Short descriptionπŸ”—

midrange_imageMidrangeImageMidrangeImagemidrange_imagemidrange_image β€” Calculate the average of maximum and minimum inside any mask.

SignatureπŸ”—

midrange_image( image Image, region Mask, out image ImageMidrange, string Margin )void MidrangeImage( const HObject& Image, const HObject& Mask, HObject* ImageMidrange, const HTuple& Margin )static void HOperatorSet.MidrangeImage( HObject image, HObject mask, out HObject imageMidrange, HTuple margin )def midrange_image( image: HObject, mask: HObject, margin: Union[int, float, str] ) -> HObject

Herror midrange_image( const Hobject Image, const Hobject Mask, Hobject* ImageMidrange, const char* Margin )

Herror T_midrange_image( const Hobject Image, const Hobject Mask, Hobject* ImageMidrange, const Htuple Margin )

HImage HImage::MidrangeImage( const HRegion& Mask, const HTuple& Margin ) const

HImage HImage::MidrangeImage( const HRegion& Mask, const HString& Margin ) const

HImage HImage::MidrangeImage( const HRegion& Mask, const char* Margin ) const

HImage HImage::MidrangeImage( const HRegion& Mask, const wchar_t* Margin ) const (Windows only)

HImage HImage.MidrangeImage( HRegion mask, HTuple margin )

HImage HImage.MidrangeImage( HRegion mask, string margin )

DescriptionπŸ”—

The operator midrange_imageMidrangeImage forms the average of maximum and minimum inside the indicated mask in the whole image. Several border treatments (Marginmarginmargin) can be chosen for filtering:

  • gray value Pixels outside of the image border are assumed to be constant (with the indicated gray value).

  • 'continued'"continued" Continuation of the gray values at the image border.

  • 'cyclic'"cyclic" Cyclic continuation at the image borders.

  • 'mirrored'"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πŸ”—

Imageimageimage (input_object) (multichannel-)image(-array) β†’ object (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)HImage (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)Hobject (byte / int2 / uint2 / int4 / real)

Image to be filtered.

Maskmaskmask (input_object) region β†’ objectHObjectHRegionHObjectHobject

Filter mask.

ImageMidrangeimageMidrangeimage_midrange (output_object) (multichannel-)image(-array) β†’ object (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)HImage (byte / int2 / uint2 / int4 / real)HObject (byte / int2 / uint2 / int4 / real)Hobject * (byte / int2 / uint2 / int4 / real)

Filtered image.

Marginmarginmargin (input_control) string β†’ (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Union[int, float, str]Htuple (char* / Hlong / double)

Border treatment.

Default: 'mirrored'"mirrored"
Suggested values: 'mirrored', 'cyclic', 'continued', 0, 30, 60, 90, 120, 150, 180, 210, 240, 255"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)
(C)
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 Maskmaskmask.

ResultπŸ”—

If the parameter values are correct the operator midrange_imageMidrangeImage 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_imageReadImage, draw_regionDrawRegion, gen_circleGenCircle, gen_rectangle1GenRectangle1

Possible successors

thresholdThreshold, dyn_thresholdDynThreshold, regiongrowingRegiongrowing

Alternatives

sigma_imageSigmaImage

See also

gen_circleGenCircle, gen_rectangle1GenRectangle1, gray_erosion_rectGrayErosionRect, gray_dilation_rectGrayDilationRect, gray_range_rectGrayRangeRect

ReferencesπŸ”—

R. Haralick, L. Shapiro; β€œComputer and Robot Vision”; Addison-Wesley, 1992, Seite 319

ModuleπŸ”—

Foundation