Plane Grayscale to RGB/RGBA Color Conversion¶
Converts an image from plane grayscale format to RGB or RGBA format.
Description
This function can operate with ROI (see Image Regions of Interest).
This function performs conversion from plane grayscale to RGB or RGBA image
by copying luminance component to color components.
If destination format is RGBA, alpha_value
from spec
shall be be used to fill alpha channel.
Headers
Headers: oneapi/ipl/convert.hpp
Syntax
-
template<typename SrcDataT, typename SrcAllocatorT, formats DstFormat, typename DstDataT, typename DstAllocatorT>
sycl::event oneapi::ipl::convert(sycl::queue &queue, image<formats::plane, SrcDataT, SrcAllocatorT> &src, image<DstFormat, DstDataT, DstAllocatorT> &dst, const convert_spec<DstDataT> &spec = {}, const std::vector<sycl::event> &dependencies = {})¶ Function for grayscale to RGB color conversion.
- Template Parameters
SrcDataT – Source image data type
SrcAllocatorT – Source image allocator type
DstFormat – Destination image format
DstDataT – Destination image data type
DstAllocatorT – Destination image allocator type
- Parameters
queue – SYCL queue object
src – Source image object
dst – Destination image object
spec – Specification for convert function
dependencies – SYCL event dependencies
- Returns
SYCL event
Supported values for DstFormat:
|
|
Parameters
See Parameters of Color Conversion (spec).
Errors
compile-time format check |
Indicates an error when image format is not supported. |
compile-time data type check |
Indicates an error when image data type is not supported. |
|
Indicates an error when ROI sizes of the source image and the destination image are not equal. |
|
Indicates an error when one of the pitch values is not divisible by size of component data type in bytes. |
The code example below demonstrates how to use the
oneapi::ipl::convert
for plane grayscale to rgba conversion:
// Create queue
sycl::queue queue{};
shared_usm_allocator_t usm_allocator{ queue };
// Source gray image data (usm_image)
image<formats::plane, std::uint8_t> src_image{ queue, src_data_pointer, src_size, usm_allocator };
// Destination rgba image data (image_image)
image<formats::rgba, std::uint8_t> dst_image{ src_size };
(void)convert(queue, src_image, dst_image);