interleave_channelsπ
Short descriptionπ
interleave_channels β Create an interleaved image from a multichannel image.
Signatureπ
interleave_channels( image MultichannelImage, out image InterleavedImage, string PixelFormat, integer RowBytes, integer Alpha )
Descriptionπ
The operator interleave_channels creates an InterleavedImage
from the input MultichannelImage 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 InterleavedImage is specified with
PixelFormat. Possible formats are 'rgb', 'rgba',
'argb', 'bgr', 'bgra', and 'abgr' for
byte images and 'rgb48', 'bgr48', 'rgba64',
'bgra64', 'argb64' and 'abgr64' for uint2
images, where βaβ denotes the 4th (βalphaβ) channel.
Be aware that, in contrast to gen_image_interleaved, LittleEndian
byte ordering is used in PixelFormat.
Alpha channelπ
The alpha channel can be defined in the following ways:
| channels | domain | |
|---|---|---|
| 3 | not specified/full | Value of Alpha is set for the complete image. |
| 3 | reduced | Inside the domain: alpha is set to Alpha. Outside the domain: alpha is set to zero. |
| 4 | Alpha is set to the respective value of the fourth channel, domain and Alpha are ignored. |
Row alignmentπ
The number of bytes between the beginning of two rows in the output
image can be set in RowBytes, e.g., to fulfill specific
alignment criteria.
Set RowBytes to 'match' if no additional padding is
required. RowBytes must be at least the number of bytes in
PixelFormat times the width of MultichannelImage.
Execution informationπ
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π
MultichannelImage (input_object) multichannel-image β object (byte)
Input multichannel image.
InterleavedImage (output_object) singlechannelimage β object (byte)
Output interleaved image.
PixelFormat (input_control) string β (string)
Target format for InterleavedImage.
Default: 'rgba'
List of values: 'abgr', 'abgr64', 'argb', 'argb64', 'bgr', 'bgr48', 'bgra', 'bgra64', 'rgb', 'rgb48', 'rgba', 'rgba64'
RowBytes (input_control) integer β (string / integer)
Number of bytes in a row of the output image.
Default: 'match'
Suggested values: 'match'
Alpha (input_control) integer β (integer)
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\;
Combinations with other operatorsπ
Moduleπ
Foundation