Operator Reference

div_imagediv_imageDivImageDivImagediv_image (Operator)

div_imagediv_imageDivImageDivImagediv_image — Divide two images.

Signature

div_image(Image1, Image2 : ImageResult : Mult, Add : )

Herror div_image(const Hobject Image1, const Hobject Image2, Hobject* ImageResult, double Mult, double Add)

Herror T_div_image(const Hobject Image1, const Hobject Image2, Hobject* ImageResult, const Htuple Mult, const Htuple Add)

void DivImage(const HObject& Image1, const HObject& Image2, HObject* ImageResult, const HTuple& Mult, const HTuple& Add)

HImage HImage::DivImage(const HImage& Image2, const HTuple& Mult, const HTuple& Add) const

HImage HImage::DivImage(const HImage& Image2, double Mult, double Add) const

static void HOperatorSet.DivImage(HObject image1, HObject image2, out HObject imageResult, HTuple mult, HTuple add)

HImage HImage.DivImage(HImage image2, HTuple mult, HTuple add)

HImage HImage.DivImage(HImage image2, double mult, double add)

def div_image(image_1: HObject, image_2: HObject, mult: Union[int, float], add: Union[int, float]) -> HObject

Description

The operator div_imagediv_imageDivImageDivImagediv_image divides two images. The gray values (g1,g2) of the input images (Image1Image1Image1image1image_1) are transformed as follows: g' := g1 / g2 * Mult + Add If an overflow or an underflow occurs the values are clipped. For a division by zero the result is set to zero.

Several images can be processed in one call. In this case both input parameters contain the same number of images which are then processed in pairs. An output image is generated for every pair.

div_imagediv_imageDivImageDivImagediv_image can be executed on an OpenCL device for byte, int1, int2, uint2, int4, real and complex images. However, since for OpenCL 1.0 only single precision floating point is supported for all devices, and not all rounding modes are supported, the OpenCL implementation can produce slightly different results from the scalar implementation.

Execution Information

  • Supports OpenCL compute devices.
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on tuple level.
  • Automatically parallelized on channel level.
  • Automatically parallelized on domain level.

Parameters

Image1Image1Image1image1image_1 (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / complex*) *allowed for compute devices

Image(s) 1.

Image2Image2Image2image2image_2 (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / complex*) *allowed for compute devices

Image(s) 2.

ImageResultImageResultImageResultimageResultimage_result (output_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject * (byte / int1 / int2 / uint2 / int4 / int8 / real / complex)

Result image(s) by the division.

MultMultMultmultmult (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Factor for gray range adaption.

Default: 255

Suggested values: 0.1, 0.2, 0.5, 1.0, 2.0, 3.0, 10, 100, 500, 1000

Value range: -1000 ≤ Mult Mult Mult mult mult ≤ 1000

Minimum increment: 0.001

Recommended increment: 1

AddAddAddaddadd (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Value for gray range adaption.

Default: 0

Suggested values: 0.0, 128.0, 256.0, 1025

Value range: -1000 ≤ Add Add Add add add ≤ 1000

Minimum increment: 0.01

Recommended increment: 1.0

Example (HDevelop)

read_image(Image1,'fabrik')
dev_display (Image1)
read_image(Image2,'monkey')
dev_display (Image2)
div_image (Image1, Image2, Result, 200, 10)
dev_display (Result)

Example (C)

read_image(&Image1,"fabrik");
disp_image(Image1,WindowHandle);
read_image(&Image2,"monkey");
disp_image(Image2,WindowHandle);
div_image(Image1,Image2,&Result,200.0,10.0);
disp_image(Result,WindowHandle);

Example (HDevelop)

read_image(Image1,'fabrik')
dev_display (Image1)
read_image(Image2,'monkey')
dev_display (Image2)
div_image (Image1, Image2, Result, 200, 10)
dev_display (Result)

Example (HDevelop)

read_image(Image1,'fabrik')
dev_display (Image1)
read_image(Image2,'monkey')
dev_display (Image2)
div_image (Image1, Image2, Result, 200, 10)
dev_display (Result)

Result

The operator div_imagediv_imageDivImageDivImagediv_image returns the value 2 ( H_MSG_TRUE) if 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>:)set_system("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.

Alternatives

add_imageadd_imageAddImageAddImageadd_image, sub_imagesub_imageSubImageSubImagesub_image, mult_imagemult_imageMultImageMultImagemult_image

See also

add_imageadd_imageAddImageAddImageadd_image, sub_imagesub_imageSubImageSubImagesub_image, mult_imagemult_imageMultImageMultImagemult_image

Module

Foundation