RGBP to RGB/RGBA Color Conversion#

Converts an image from RGBP (3 plane RGB) format to RGB or RGBA format.

Description

This function can operate with ROI (see Image Regions of Interest).

This function performs conversion from 3-plane RGB image to RGB or RGBA image leaving pixel values unchanged, only changing memory layout from 3 plane 1 channel per plane to 1 plane 3 or 4 channels depending on destination image format. If destination layout is channel4 (format is RGBA) , alpha_value from spec must be used to fill alpha channel.

Headers

oneapi/ipl/convert.hpp

template<typename SrcImageT, typename DstImageT>
sycl::event oneapi::ipl::rgbp_to_rgb(sycl::queue &queue, SrcImageT &src, DstImageT &dst, const color_conversion_spec<typename DstImageT::data_t> &spec = {}, const std::vector<sycl::event> &dependencies = {})#

Function for RGBP to RGB or RGBA color conversion.

Template Parameters:
  • SrcImageT – Source image type

  • DstImageT – Destination image 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 destination layout:

channel3

channel4

Parameters

See Parameters of Color Conversion (spec).

Errors

compile-time memory layout check

Indicates an error when image memory layout is not supported.

compile-time data type check

Indicates an error when image data type is not supported.

invalid_argument exception

Indicates an error when ROI sizes of the source image and the destination image are not equal.

invalid_argument exception

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 oneapi::ipl::rgbp_to_rgb shall be called for RGBP to RGBA conversion:

using namespace oneapi;

sycl::queue                 queue;
ipl::shared_usm_allocator_t allocator{ queue };
const sycl::range<2>        image_size{ height, width };

// Source image for RGBP data
ipl::image<ipl::layouts::plane3, std::uint8_t> src_image{ queue, p_image_data, image_size, allocator };
// Destination image for RGBA data
ipl::image<ipl::layouts::channel4, std::uint8_t> dst_image{ image_size, allocator };

// Convert RGBP to RGBA
auto event = ipl::rgbp_to_rgb(queue, src_image, dst_image);