Transpose Operation#
Transpose the image data.
Description
This function transposes the source image on to the destination image. This function moves pixels from coordinate \((x,y)\) to coordinate \((y,x)\) in the destination image. The function performs the following operation:
Headers
oneapi/ipl/misc/transpose.hpp
Syntax
-
template<typename SrcImageT, typename DstImageT>
sycl::event oneapi::ipl::transpose(sycl::queue &queue, SrcImageT &src, DstImageT &dst, const transpose_spec &spec = {}, const std::vector<sycl::event> &dependencies = {})# Transpose image without type conversion.
- 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
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
-
class transpose_spec#
Transpose specification.
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. |
|
Indicates an error when ROI sizes of the source image and the destination image are not transposed. |
|
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::transpose
shall be
called:
using namespace oneapi;
sycl::queue queue;
ipl::shared_usm_allocator_t allocator{ queue };
const sycl::range<2> src_size{ height, width };
const sycl::range<2> dst_size{ src_size[1], src_size[0] };
// Source 4-channel image data
ipl::image<ipl::layouts::channel4, std::uint8_t> src_image{ queue, p_image_data, src_size, allocator };
// Destination 4-channel image data
ipl::image<ipl::layouts::channel4, std::uint8_t> dst_image{ dst_size, allocator };
// Transpose image
auto event = ipl::transpose(queue, src_image, dst_image);