Resize Supersampling#

Changes an image size using the super sampling interpolation method.

Description

This function changes an image size using the super sampling interpolation method. This method only reduces the image size. The interpolation algorithm applied uses only pixels of the source image origin that are inside of the image boundaries. Resize Supersampling function supports edge smoothing (see Edge Smoothing). This function can operate with ROI (see Image Regions of Interest).

Before using the resize_supersampling function, implementation must initialize the resize_supersampling_spec.

Headers

oneapi/ipl/transform/resize_supersampling.hpp

Syntax

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

Resize supersampling.

Template Parameters:
  • ComputeT – type to perform calculations

  • 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

Supported values for ComputeT:

float

double

half

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 DataT = std::uint8_t):

sub420

sub420i

Parameters

template<typename ComputeT = float>
class resize_supersampling_spec#

Resize supersampling parameters.

Template Parameters:

ComputeT – the type for computations

Public Functions

constexpr resize_supersampling_spec() noexcept = default#

Construct resize supersampling specification.

explicit constexpr resize_supersampling_spec(ComputeT x_shift, ComputeT y_shift, smooth_types smooth_edge = smooth_types::off) noexcept#

Construct resize supersampling specification.

Parameters:
  • x_shift – subpixel shift in x direction

  • y_shift – subpixel shift in y direction

  • smooth_edge – edge smoothing parameter

constexpr ComputeT get_shift_x() const noexcept#

Returns the x component of the subpixel shift.

Returns:

the x component of the subpixel shift

constexpr ComputeT get_shift_y() const noexcept#

Returns the y component of the shift.

Returns:

the y component of the shift

constexpr smooth_types is_smooth_edge() const noexcept#

Returns the flag of edge smoothing.

Returns:

the flag of edge smoothing

Errors

compile-time layout check

Indicates an error when image 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 the destination image ROI size is greater than the source image ROI size.

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::resize_supersampling 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 };
// Destination 4-channel image data with 2x smaller size
ipl::image<ipl::layouts::channel4, std::uint8_t> dst_image{ image_size / 2, allocator };

const ipl::resize_supersampling_spec spec{ 0.1f, 0.1f, ipl::smooth_types::on };

// Resize supersampling with {0.1, 0.1} shift and edge smoothing enabled
auto event = ipl::resize_supersampling(queue, src_image, dst_image, spec);