interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsinterleave_channels (Operator)

Name

interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsinterleave_channels — Create an interleaved image from a multichannel image.

Signature

interleave_channels(MultichannelImage : InterleavedImage : PixelFormat, RowBytes, Alpha : )

Herror interleave_channels(const Hobject MultichannelImage, Hobject* InterleavedImage, const char* PixelFormat, const char* RowBytes, const Hlong Alpha)

Herror T_interleave_channels(const Hobject MultichannelImage, Hobject* InterleavedImage, const Htuple PixelFormat, const Htuple RowBytes, const Htuple Alpha)

void InterleaveChannels(const HObject& MultichannelImage, HObject* InterleavedImage, const HTuple& PixelFormat, const HTuple& RowBytes, const HTuple& Alpha)

HImage HImage::InterleaveChannels(const HString& PixelFormat, const HTuple& RowBytes, Hlong Alpha) const

HImage HImage::InterleaveChannels(const HString& PixelFormat, const HString& RowBytes, Hlong Alpha) const

HImage HImage::InterleaveChannels(const char* PixelFormat, const char* RowBytes, Hlong Alpha) const

HImage HImage::InterleaveChannels(const wchar_t* PixelFormat, const wchar_t* RowBytes, Hlong Alpha) const   ( Windows only)

static void HOperatorSet.InterleaveChannels(HObject multichannelImage, out HObject interleavedImage, HTuple pixelFormat, HTuple rowBytes, HTuple alpha)

HImage HImage.InterleaveChannels(string pixelFormat, HTuple rowBytes, int alpha)

HImage HImage.InterleaveChannels(string pixelFormat, string rowBytes, int alpha)

def interleave_channels(multichannel_image: HObject, pixel_format: str, row_bytes: Union[str, int], alpha: int) -> HObject

Description

The operator interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsinterleave_channels creates an InterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image from the input MultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_image containing three or four channels. This is useful to prepare a color image for visualization, e.g., by converting it to a .NET Bitmap.

Pixel format

The format of the pixels in InterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image is specified with PixelFormatPixelFormatPixelFormatpixelFormatpixel_format. Possible formats are 'rgb'"rgb""rgb""rgb""rgb", 'rgba'"rgba""rgba""rgba""rgba", 'argb'"argb""argb""argb""argb", 'bgr'"bgr""bgr""bgr""bgr", 'bgra'"bgra""bgra""bgra""bgra", and 'abgr'"abgr""abgr""abgr""abgr" for BYTE images and 'rgb48'"rgb48""rgb48""rgb48""rgb48", 'bgr48'"bgr48""bgr48""bgr48""bgr48", 'rgba64'"rgba64""rgba64""rgba64""rgba64", 'bgra64'"bgra64""bgra64""bgra64""bgra64", 'argb64'"argb64""argb64""argb64""argb64" and 'abgr64'"abgr64""abgr64""abgr64""abgr64" for UINT2 images, where 'a' denotes the 4th ('alpha') channel. Be aware that, in contrast to gen_image_interleavedgen_image_interleavedGenImageInterleavedGenImageInterleavedgen_image_interleaved, LittleEndian byte ordering is used in PixelFormatPixelFormatPixelFormatpixelFormatpixel_format.

Alpha channel

The alpha channel can be defined in the following ways:
channels domain
3 not specified/full Value of AlphaAlphaAlphaalphaalpha is set for the complete image.
3 reduced Inside the domain: alpha is set to AlphaAlphaAlphaalphaalpha. Outside the domain: alpha is set to zero.
4 Alpha is set to the respective value of the fourth channel, domain and AlphaAlphaAlphaalphaalpha are ignored.

Row alignment

The number of bytes between the beginning of two rows in the output image can be set in RowBytesRowBytesRowBytesrowBytesrow_bytes, e.g., to fulfill specific alignment criteria. Set RowBytesRowBytesRowBytesrowBytesrow_bytes to 'match'"match""match""match""match" if no additional padding is required. RowBytesRowBytesRowBytesrowBytesrow_bytes must be at least the number of bytes in PixelFormatPixelFormatPixelFormatpixelFormatpixel_format times the width of MultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_image.

Execution Information

Parameters

MultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_image (input_object)  multichannel-image objectHImageHObjectHObjectHobject (byte)

Input multichannel image.

InterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image (output_object)  singlechannelimage objectHImageHObjectHObjectHobject * (byte)

Output interleaved image.

PixelFormatPixelFormatPixelFormatpixelFormatpixel_format (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Target format for InterleavedImage.

Default: 'rgba' "rgba" "rgba" "rgba" "rgba"

List of values: 'abgr'"abgr""abgr""abgr""abgr", 'abgr64'"abgr64""abgr64""abgr64""abgr64", 'argb'"argb""argb""argb""argb", 'argb64'"argb64""argb64""argb64""argb64", 'bgr'"bgr""bgr""bgr""bgr", 'bgr48'"bgr48""bgr48""bgr48""bgr48", 'bgra'"bgra""bgra""bgra""bgra", 'bgra64'"bgra64""bgra64""bgra64""bgra64", 'rgb'"rgb""rgb""rgb""rgb", 'rgb48'"rgb48""rgb48""rgb48""rgb48", 'rgba'"rgba""rgba""rgba""rgba", 'rgba64'"rgba64""rgba64""rgba64""rgba64"

RowBytesRowBytesRowBytesrowBytesrow_bytes (input_control)  integer HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Number of bytes in a row of the output image.

Default: 'match' "match" "match" "match" "match"

Suggested values: 'match'"match""match""match""match"

AlphaAlphaAlphaalphaalpha (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Alpha value for three channel input images.

Default: 255

Suggested values: 255, 0

Example (C#)

  HTuple type, width, height;
  HImage patras = new HImage("patras");

  HImage interleaved = patras.InterleaveChannels("argb", "match", 255);
  IntPtr ptr = interleaved.GetImagePointer1(out type, out width, out height);

  Image img = new Bitmap(width/4, height, width,
                         PixelFormat.Format32bppArgb, ptr);

  pictureBox.Image = img;

See also

gen_image_interleavedgen_image_interleavedGenImageInterleavedGenImageInterleavedgen_image_interleaved

Module

Foundation