interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsinterleave_channels (Operator)
Name
interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsinterleave_channels — Create an interleaved image from a multichannel image.
Signature
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)
Description
The operator interleave_channelsinterleave_channelsInterleaveChannelsInterleaveChannelsInterleaveChannelsinterleave_channels creates an InterleavedImageInterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image
from the input MultichannelImageMultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_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 InterleavedImageInterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image is specified with
PixelFormatPixelFormatPixelFormatPixelFormatpixelFormatpixel_format. Possible formats are 'rgb'"rgb""rgb""rgb""rgb""rgb",'rgba'"rgba""rgba""rgba""rgba""rgba",
'argb'"argb""argb""argb""argb""argb",'bgr'"bgr""bgr""bgr""bgr""bgr",'bgra'"bgra""bgra""bgra""bgra""bgra", and 'abgr'"abgr""abgr""abgr""abgr""abgr", where 'a'
denotes the 4th ('alpha') channel.
Be aware that, in contrast to gen_image_interleavedgen_image_interleavedGenImageInterleavedGenImageInterleavedGenImageInterleavedgen_image_interleaved, LittleEndian
byte ordering is used in PixelFormatPixelFormatPixelFormatPixelFormatpixelFormatpixel_format.
Alpha channel
The alpha channel can be defined in the following ways:
Row alignment
The number of bytes between the beginning of two rows in the output
image can be set in RowBytesRowBytesRowBytesRowBytesrowBytesrow_bytes, e.g. to fulfill specific
alignment criteria.
Set RowBytesRowBytesRowBytesRowBytesrowBytesrow_bytes to 'match'"match""match""match""match""match" if no additional padding is
required. RowBytesRowBytesRowBytesRowBytesrowBytesrow_bytes must be at least the number of bytes in
PixelFormatPixelFormatPixelFormatPixelFormatpixelFormatpixel_format times the width of MultichannelImageMultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_image.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on internal data level.
Parameters
MultichannelImageMultichannelImageMultichannelImageMultichannelImagemultichannelImagemultichannel_image (input_object) multichannel-image → objectHImageHObjectHImageHobject (byte)
Input multichannel image.
InterleavedImageInterleavedImageInterleavedImageInterleavedImageinterleavedImageinterleaved_image (output_object) singlechannelimage → objectHImageHObjectHImageHobject * (byte)
Output interleaved image.
PixelFormatPixelFormatPixelFormatPixelFormatpixelFormatpixel_format (input_control) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Target format for InterleavedImage.
Default value:
'rgba'
"rgba"
"rgba"
"rgba"
"rgba"
"rgba"
List of values: 'abgr'"abgr""abgr""abgr""abgr""abgr", 'argb'"argb""argb""argb""argb""argb", 'bgr'"bgr""bgr""bgr""bgr""bgr", 'bgra'"bgra""bgra""bgra""bgra""bgra", 'rgb'"rgb""rgb""rgb""rgb""rgb", 'rgba'"rgba""rgba""rgba""rgba""rgba"
RowBytesRowBytesRowBytesRowBytesrowBytesrow_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 value:
'match'
"match"
"match"
"match"
"match"
"match"
Suggested values: 'match'"match""match""match""match""match"
AlphaAlphaAlphaAlphaalphaalpha (input_control) integer → HTupleintHTupleHtuple (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_interleavedGenImageInterleavedGenImageInterleavedGenImageInterleavedgen_image_interleaved
Module
Foundation