Mirror#

Mirrors an image about the specified axis.

Description

This function mirrors the source image about the axis defined in mirror_spec class. This function uses vertical axis by default. This function can operate with ROI (see Image Regions of Interest).

Headers

oneapi/ipl/transform/mirror.hpp

Syntax

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

Mirror.

Template Parameters:
  • SrcImageT – Source image type

  • DstImageT – Destination image type

Parameters:
  • queue – SYCL queue

  • src – source image

  • dst – destination image

  • spec – algorithmic specification

  • dependencies – dependencies

Returns:

SYCL event

Parameters

axis type support

Type of axis. Possible values are:

horizontal - Specifies the horizontal axis to mirror the image about.

vertical - Specifies the vertical axis to mirror the image about.

both - Specifies both horizontal and vertical axes to mirror the image about.

diagonal_45 - Specifies the horizontal axis rotated counterclockwise by 45 degrees to mirror the image about.

diagonal_135 - Specifies the horizontal axis rotated counterclockwise by 135 degrees to mirror the image about.

class mirror_spec#

Mirror specification.

Public Functions

constexpr mirror_spec() noexcept = default#

Construct mirror specification with default vertical axis.

inline explicit constexpr mirror_spec(const ipl::axes axis) noexcept#

Construct mirror specification.

Parameters:

axis – of mirror

inline constexpr ipl::axes get_axis() const noexcept#

Returns the axis of mirror.

Returns:

the axis of mirror

Supported combinations for DataT/Layouts:

DataT/Layouts

plane

channel3

channel4

plane3

std::uint8_t

std::int8_t

std::uint16_t

std::int16_t

std::uint32_t

std::int32_t

float

double

Supported values for subsampled layout (only for std::uint8_t data type):

sub420

sub420i

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.

compile-time compute data type check

Indicates an error when compute 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::mirror shall be called:

using namespace oneapi;

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

// Source 4-channel image data
ipl::image<ipl::layouts::channel4, std::uint8_t> src_image{ queue, p_image_data, image_size, allocator };
// Desination 4-channel image data
ipl::image<ipl::layouts::channel4, std::uint8_t> dst_image{ image_size, allocator };

// Create mirror image. Axis of mirror is vertical by default
auto event = ipl::mirror(queue, src_image, dst_image);