You are here: Start » Image » Image Conversions » ConvertPixelType
ConvertPixelType
Header: | AVL.h |
---|---|
Namespace: | avl |
Changes the type of pixel components.
Syntax
void avl::ConvertPixelType ( const avl::Image& inImage, atl::Optional<const avl::Region&> inRoi, avl::PlainType::Type inNewType, int inDepthDelta, avl::Image& outImage )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inImage | const Image& | Input image | |||
inRoi | Optional<const Region&> | NIL | Range of pixels to be processed | ||
inNewType | PlainType::Type | UInt8 | Type of the output image | ||
inDepthDelta | int | -30 - 30 | 0 | Pixel values will be multiplied by 2^inDepthDelta. For example, use -4 to convert 12-bit to 8-bit images. | |
outImage | Image& | Output image |
Description
The operation alters the pixel component format of the inImage. Available formats are listed in the documentation of the Image data type.
If the value of pixel component doesn't fit in the range of the new type, it is clipped to the nearest proper value, which can lead to the significant loss of information, as demonstrated in the example.
Examples
Hardware Acceleration
This operation supports automatic parallelization for multicore and multiprocessor systems.
This operation is optimized for SSE2 technology for pixels of types: UINT16 (when converting to UINT8 with negative delta).
This operation is optimized for AVX2 technology for pixels of types: UINT16 (when converting to UINT8 with negative delta).
This operation is optimized for NEON technology for pixels of types: UINT16 (when converting to UINT8 with negative delta).
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Region exceeds an input image in ConvertPixelType. |