Skip to content

rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayrgb1_to_grayrgb1_to_gray🔗

Short description🔗

rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayrgb1_to_grayrgb1_to_gray — Transform an RGB image into a gray scale image.

Signature🔗

rgb1_to_gray( image RGBImage, out image GrayImage )rgb1_to_gray( RGBImage : GrayImage : : )void Rgb1ToGray( const HObject& RGBImage, HObject* GrayImage )static void HOperatorSet.Rgb1ToGray( HObject RGBImage, out HObject grayImage )def rgb1_to_gray( rgbimage: HObject ) -> HObject

Herror rgb1_to_gray( const Hobject RGBImage, Hobject* GrayImage )

Herror T_rgb1_to_gray( const Hobject RGBImage, Hobject* GrayImage )

HImage HImage::Rgb1ToGray( ) const

HImage HImage.Rgb1ToGray( )

Description🔗

rgb1_to_grayRgb1ToGray transforms an RGB image into a gray scale image. The three channels of the RGB image are passed as the first three channels of the input image. The image is transformed according to the following formula: gray = 0.299 * red + 0.587 * green + 0.114 * blue .

If one of the input images in RGBImageRGBImagergbimage is a single-channel image its reference will be simply copied to the output GrayImagegrayImagegray_image.

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 domain level.

Parameters🔗

RGBImageRGBImagergbimage (input_object) (multichannel-)image(-array) → object (byte / int2 / uint2 / real)object (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)HImage (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)Hobject (byte / int2 / uint2 / real)

Three-channel RBG image.

GrayImagegrayImagegray_image (output_object) singlechannelimage(-array) → object (byte / int2 / uint2 / real)object (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)HImage (byte / int2 / uint2 / real)HObject (byte / int2 / uint2 / real)Hobject * (byte / int2 / uint2 / real)

Gray scale image.

Example🔗

(HDevelop)


* Transformation from rgb to gray
read_image(Image,'patras')
dev_display(Image)
rgb1_to_gray(Image,GrayImage)
dev_display(GrayImage)
(C)
/* Transformation from rgb to gray  */
read_image(Image,"patras")\;
disp_color(Image,WindowHandle)\;
rgb1_to_gray(Image,&GrayImage)\;
disp_image(GrayImage,WindowHandle)\;

Combinations with other operators🔗

Combinations

Possible predecessors

compose3Compose3

Alternatives

trans_from_rgbTransFromRgb, rgb3_to_grayRgb3ToGray

Module🔗

Foundation