Resize with Lanczos Interpolation#
Changes an image size using interpolation with the Lanczos filter.
Description
This function changes an image size using interpolation with the
Lanczos filter. The image size may be either reduced or increased in
each direction, depending on the destination image size. This method
is based on the 3-lobed Lanczos window function as an interpolation function.
Algorithm parameters must be set through the resize_lanczos_spec
class.
The border pixels are processed in accordance with the border type.
This function can operate with ROI (see Image Regions of Interest).
Headers
oneapi/ipl/transform/resize_lanczos.hpp
Syntax
-
template<typename ComputeT = float, typename SrcImageT, typename DstImageT>
sycl::event oneapi::ipl::resize_lanczos(sycl::queue &queue, SrcImageT &src, DstImageT &dst, const resize_lanczos_spec &spec = {}, const std::vector<sycl::event> &dependencies = {})# Resize with the Lanczos interpolation method.
- Template Parameters:
ComputeT – type to perform calculations
SrcImageT – Source image type
DstImageT – Destination image type
- Parameters:
queue – [in] SYCL queue
src – [in] source image
dst – [out] destination image
spec – [in] algorithm parameters
dependencies – [in] other events dependencies
- Returns:
SYCL event, that represents algorithm completion
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 std::uint8_t
data type):
sub420 |
sub420i |
---|---|
✓ |
✓ |
Parameters
border type support |
Type of border. Possible values are:
|
-
class resize_lanczos_spec#
Resize Lanczos parameters.
Public Functions
-
resize_lanczos_spec() = default#
Construct default spec.
-
resize_lanczos_spec(border_types border_type)#
Construct spec from border type.
- Parameters:
border_type – border type
-
resize_lanczos_spec(crop_types crop)#
Construct spec from crop flag.
- Parameters:
crop – crop flag
-
resize_lanczos_spec(border_types border_type, crop_types crop)#
Construct spec from border type and crop flag.
- Parameters:
border_type – border type
crop – crop flag
-
crop_types get_crop() const noexcept#
Returns the crop type.
- Returns:
crop type
-
border_types get_border() const noexcept#
Returns the border type.
- Returns:
border type
-
resize_lanczos_spec() = default#
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. |
|
Indicates an error when one of the pitch values is not divisible by size of component data type in bytes. |
|
Indicates an error when border type is not supported. |
The code example below demonstrates how
oneapi::ipl::resize_lanczos
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 x2 size
ipl::image<ipl::layouts::channel4, std::uint8_t> dst_image{ image_size * 2, allocator };
auto event = ipl::resize_lanczos(queue, src_image, dst_image);