Image Helper

Description

Image helper class provides additional functionality for working with image data.

Include Files

oneapi/ipl.hpp

Domain Dependencies

Headers: oneapi/ipl.hpp

Libraries: oneipl.lib

Syntax

template<formats Format, typename DataT, typename AllocatorT = select_image_allocator_t<Format, DataT>, typename UsmAllocatorT = default_usm_allocator_t>
class oneapi::ipl::image_helper : public detail::image_helper_impl_t<Format, DataT, select_image_allocator_t<Format, DataT>, default_usm_allocator_t>

Provides additional functionality for working with image data.

Template Parameters
  • Format – the given format of an image

  • DataT – the given type of a pixel component

  • AllocatorT – the given type of an allocator

  • UsmAllocatorT – the given type of an USM allocator

Public Functions

explicit image_helper(const ipl::image<Format, DataT, AllocatorT> &image, const UsmAllocatorT &usm_allocator)

Constructor for the image helper class.

Parameters
  • image[in] the given image

  • usm_allocator[in] the given USM allocator

explicit image_helper(ipl::image<Format, DataT, AllocatorT> &&image, const UsmAllocatorT &usm_allocator)

Constructor for the image helper class.

Parameters
  • image[in] the given image

  • usm_allocator[in] the given USM allocator

std::size_t get_width() const

Returns the width of the ROI (for the whole image returns the width of the image).

Returns

the width of the ROI

std::size_t get_height() const

Returns the height of the ROI (for the whole image returns the height of the image).

Returns

the height of the ROI

void flush()

Clears all events associated with the image.

The code example below demonstrates how to use the oneapi::ipl::image_helper:

// Create queue
sycl::queue queue{};

// Create allocator
sycl::usm_allocator<std::uint8_t, sycl::usm::alloc::shared> allocator{ queue };

// Source RGBA image data (image_image)
image<formats::rgba, std::uint8_t> src_image{ src_data_pointer, image_size };
// Image helper
image_helper helper{ src_image, allocator };
// Destination RGBA image data (image_image)
image<formats::rgba, std::uint8_t> dst_image{ helper.get_pointer(), image_size };