interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannels (Operator)

Name

interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannels — 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)

Description

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

Pixelformat

The format of the pixels in InterleavedImageInterleavedImageInterleavedImageInterleavedImageinterleavedImage is specified with PixelFormatPixelFormatPixelFormatPixelFormatpixelFormat. 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", where 'a' denotes the 4th ('alpha') channel. Be aware that, in contrast to gen_image_interleavedgen_image_interleavedGenImageInterleavedGenImageInterleavedGenImageInterleaved, LittleEndian byte ordering is used in PixelFormatPixelFormatPixelFormatPixelFormatpixelFormat.

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 alignement

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

Execution Information

Parameters

MultichannelImageMultichannelImageMultichannelImageMultichannelImagemultichannelImage (input_object)  multichannel-image objectHImageHImageHobject (byte)

Input multichannel image.

InterleavedImageInterleavedImageInterleavedImageInterleavedImageinterleavedImage (output_object)  singlechannelimage objectHImageHImageHobject * (byte)

Output interleaved image.

PixelFormatPixelFormatPixelFormatPixelFormatpixelFormat (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Target format for InterleavedImage.

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

List of values: 'abgr'"abgr""abgr""abgr""abgr", 'argb'"argb""argb""argb""argb", 'bgr'"bgr""bgr""bgr""bgr", 'bgra'"bgra""bgra""bgra""bgra", 'rgb'"rgb""rgb""rgb""rgb", 'rgba'"rgba""rgba""rgba""rgba"

RowBytesRowBytesRowBytesRowBytesrowBytes (input_control)  integer HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Number of bytes in a row of the output image.

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

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

AlphaAlphaAlphaAlphaalpha (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Alpha value for three channel input images.

Default value: 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_interleavedGenImageInterleavedGenImageInterleavedGenImageInterleaved

Module

Foundation