midrange_imagemidrange_imageMidrangeImageMidrangeImagemidrange_image (Operator)

Name

midrange_imagemidrange_imageMidrangeImageMidrangeImagemidrange_image — Calculate the average of maximum and minimum inside any mask.

Signature

midrange_image(Image, Mask : ImageMidrange : Margin : )

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)

void MidrangeImage(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)

static void HOperatorSet.MidrangeImage(HObject image, HObject mask, out HObject imageMidrange, HTuple margin)

HImage HImage.MidrangeImage(HRegion mask, HTuple margin)

HImage HImage.MidrangeImage(HRegion mask, string margin)

def midrange_image(image: HObject, mask: HObject, margin: Union[int, float, str]) -> HObject

Description

The operator midrange_imagemidrange_imageMidrangeImageMidrangeImageMidrangeImagemidrange_image forms the average of maximum and minimum inside the indicated mask in the whole image. Several border treatments (MarginMarginMarginMarginmarginmargin) can be chosen for filtering: gray value Pixels outside of the image edges are assumed to be constant (with the indicated gray value). 'continued' Continuation of edge pixels. 'cyclic' Cyclic continuation of image edges. 'mirrored' Reflection of pixels at the image edges. 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

Parameters

ImageImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / int2 / uint2 / int4 / real)

Image to be filtered.

MaskMaskMaskMaskmaskmask (input_object)  region objectHRegionHObjectHRegionHobject

Filter mask.

ImageMidrangeImageMidrangeImageMidrangeImageMidrangeimageMidrangeimage_midrange (output_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte / int2 / uint2 / int4 / real)

Filtered image.

MarginMarginMarginMarginmarginmargin (input_control)  string HTupleUnion[int, float, str]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Border treatment.

Default value: 'mirrored' "mirrored" "mirrored" "mirrored" "mirrored" "mirrored"

Suggested values: 'mirrored'"mirrored""mirrored""mirrored""mirrored""mirrored", 'cyclic'"cyclic""cyclic""cyclic""cyclic""cyclic", 'continued'"continued""continued""continued""continued""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)

Example (C)

read_image(&Image,"fabrik");
draw_region(&Region,WindowHandle);
midrange_image(Image,Region,&Midrange,"mirrored");
disp_image(Midrange,WindowHandle);

Example (HDevelop)

read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
midrange_image(Image,Region,Midrange,'mirrored')
dev_display(Midrange)

Example (HDevelop)

read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
midrange_image(Image,Region,Midrange,'mirrored')
dev_display(Midrange)

Example (HDevelop)

read_image(Image,'fabrik')
draw_region(Region,WindowHandle)
midrange_image(Image,Region,Midrange,'mirrored')
dev_display(Midrange)

Complexity

For each pixel: O(sqrt(F) * 5) with F = area of MaskMaskMaskMaskmaskmask.

Result

If the parameter values are correct the operator midrange_imagemidrange_imageMidrangeImageMidrangeImageMidrangeImagemidrange_image returns the value TRUE. The behavior in case of empty input (no input images available) is set via the operator set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary an exception is raised.

Possible Predecessors

read_imageread_imageReadImageReadImageReadImageread_image, draw_regiondraw_regionDrawRegionDrawRegionDrawRegiondraw_region, gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1

Possible Successors

thresholdthresholdThresholdThresholdThresholdthreshold, dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing

Alternatives

sigma_imagesigma_imageSigmaImageSigmaImageSigmaImagesigma_image

See also

gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1, gray_erosion_rectgray_erosion_rectGrayErosionRectGrayErosionRectGrayErosionRectgray_erosion_rect, gray_dilation_rectgray_dilation_rectGrayDilationRectGrayDilationRectGrayDilationRectgray_dilation_rect, gray_range_rectgray_range_rectGrayRangeRectGrayRangeRectGrayRangeRectgray_range_rect

References

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

Module

Foundation