Skip to content

invert_imageInvertImageInvertImageinvert_imageinvert_imageπŸ”—

Short descriptionπŸ”—

invert_imageInvertImageInvertImageinvert_imageinvert_image β€” Invert an image.

SignatureπŸ”—

invert_image( image Image, out image ImageInvert )void InvertImage( const HObject& Image, HObject* ImageInvert )static void HOperatorSet.InvertImage( HObject image, out HObject imageInvert )def invert_image( image: HObject ) -> HObject

Herror invert_image( const Hobject Image, Hobject* ImageInvert )

Herror T_invert_image( const Hobject Image, Hobject* ImageInvert )

HImage HImage::InvertImage( ) const

HImage HImage.InvertImage( )

DescriptionπŸ”—

The operator invert_imageInvertImage inverts the gray values of an image. For images of the byte and cyclic type the result is calculated as: g’ = 255 - g Images of the β€˜direction’ type are transformed by g’ = (g + 90) modulo 180 In the case of signed types the values are negated. The resulting image has the same pixel type as the input image.

* Several images can be processed in one call. An output image is generated for every input image.

invert_imageInvertImage can be executed on an OpenCL device for byte, direction, cyclic, int1, int2, uint2, int4, and real images.

Execution informationπŸ”—

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πŸ”—

Imageimageimage (input_object) (multichannel-)image(-array) β†’ object (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / int8 / real*)HObject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / int8 / real*)HImage (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / int8 / real*)HObject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / int8 / real*)Hobject (byte* / direction* / cyclic* / int1* / int2* / uint2* / int4* / int8 / real*) *allowed for compute devices

Input image(s).

ImageInvertimageInvertimage_invert (output_object) (multichannel-)image(-array) β†’ object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)HImage (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)Hobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real)

Image(s) with inverted gray values.

ExampleπŸ”—

(HDevelop)

read_image(Orig,'fabrik')
invert_image(Orig,Invert)
dev_display(Invert)
(C)
read_image(&Orig,"fabrik")\;
invert_image(Orig,&Invert)\;
disp_image(Invert,WindowHandle)\;
(C++)
#include "HalconCpp.h"
using namespace Halcon\;
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std\;
#endif

int main()
{
  HWindow  win\;
  HImage   inv,
           org ("monkey")\;
  cout << "Display original image" << endl\;
   org.Display (win)\;
   win.Click ()\;
  inv = org.InvertImage ()\;
  cout << "Display inverted image" << endl\;
   inv.Display (win)\;
   win.Click ()\;
  return 0\;
}

Combinations with other operatorsπŸ”—

Combinations

Possible successors

watershedsWatersheds

Alternatives

scale_imageScaleImage

See also

scale_imageScaleImage, add_imageAddImage, sub_imageSubImage

ModuleπŸ”—

Foundation