RGB/RGBA to RGBP Color Conversion¶
Converts an image from RGB or RGBA format to RGBP (3 plane RGB) format.
Description
This function can operate with ROI (see Image Regions of Interest).
This function performs conversion from RGB or RGBA image to 3-plane RGB image leaving pixel values unchanged, only changing memory layout from 1 plane 3 or 4 channels depending on source image format to 3 plane 1 channel per plane. In case of RGBA format, alpha channel is ignored and it’s values are lost.
Headers
oneapi/ipl/convert.hpp
Syntax
-
template<formats SrcFormat, typename SrcDataT, typename SrcAllocatorT, typename DstDataT, typename DstAllocatorT>
sycl::event oneapi::ipl::convert(sycl::queue &queue, image<SrcFormat, SrcDataT, SrcAllocatorT> &src, image<formats::rgbp, DstDataT, DstAllocatorT> &dst, const convert_spec<DstDataT> &spec = {}, const std::vector<sycl::event> &dependencies = {})¶ Function for RGB or RGBA to RGBP (plane rgb) color conversion.
- Template Parameters
SrcFormat – Source image color format
SrcDataT – Source image data type
SrcAllocatorT – Source image allocator type
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 SrcFormat:
|
|
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 RGBA to RGBP conversion:
// Create queue
sycl::queue queue{};
shared_usm_allocator_t usm_allocator{ queue };
// Source rgba image data (image_image)
image<formats::rgba, std::uint8_t> src_image{ src_data_pointer, src_size };
// Destination rgbp image data (usm_image)
image<formats::rgbp, std::uint8_t> rgbp_image{ src_size, usm_allocator };
(void)convert(queue, src_image, rgbp_image);