Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub
Image Transformation

Functions for image transformation (transposition, rotation). More...

Enumerations

enum  SimdTransformType {
  SimdTransformRotate0 = 0 ,
  SimdTransformRotate90 ,
  SimdTransformRotate180 ,
  SimdTransformRotate270 ,
  SimdTransformTransposeRotate0 ,
  SimdTransformTransposeRotate90 ,
  SimdTransformTransposeRotate180 ,
  SimdTransformTransposeRotate270
}
 

Functions

SIMD_API void SimdTransformImage (const uint8_t *src, size_t srcStride, size_t width, size_t height, size_t pixelSize, SimdTransformType transform, uint8_t *dst, size_t dstStride)
 Copies, rotates, mirrors or transposes an image according to SimdTransformType. More...
 
SIMD_INLINE Point< ptrdiff_t > TransformSize (const Point< ptrdiff_t > &size, ::SimdTransformType transform)
 Gets size of transformed image. More...
 
template<template< class > class A>
SIMD_INLINE void TransformImage (const View< A > &src, ::SimdTransformType transform, View< A > &dst)
 Performs transformation of input image. The type of transformation is defined by SimdTransformType enumeration. More...
 

Detailed Description

Functions for image transformation (transposition, rotation).

Enumeration Type Documentation

◆ SimdTransformType

Describes image transform type used by SimdTransformImage.

The transform maps an input image to an output image with the same pixel size. SimdTransformRotate90, SimdTransformRotate270, SimdTransformTransposeRotate0 and SimdTransformTransposeRotate180 swap output width and height. The other transform types keep the original size.

Enumerator
SimdTransformRotate0 

Copy without rotation; output size equals input size.

SimdTransformRotate90 

Rotate 90 degrees counterclockwise; output width/height are input height/width.

SimdTransformRotate180 

Rotate 180 degrees; output size equals input size.

SimdTransformRotate270 

Rotate 270 degrees counterclockwise; output width/height are input height/width.

SimdTransformTransposeRotate0 

Transpose over the main diagonal; output width/height are input height/width.

SimdTransformTransposeRotate90 

Transpose then rotate 90 degrees counterclockwise; equivalent to horizontal mirror.

SimdTransformTransposeRotate180 

Transpose then rotate 180 degrees; output width/height are input height/width.

SimdTransformTransposeRotate270 

Transpose then rotate 270 degrees counterclockwise; equivalent to vertical mirror.

Function Documentation

◆ SimdTransformImage()

void SimdTransformImage ( const uint8_t *  src,
size_t  srcStride,
size_t  width,
size_t  height,
size_t  pixelSize,
SimdTransformType  transform,
uint8_t *  dst,
size_t  dstStride 
)

Copies, rotates, mirrors or transposes an image according to SimdTransformType.

The function supports pixels with size 1, 2, 3 or 4 bytes. For SimdTransformRotate0, SimdTransformRotate180, SimdTransformTransposeRotate90 and SimdTransformTransposeRotate270 the output image has the same width and height as the input image. For SimdTransformRotate90, SimdTransformRotate270, SimdTransformTransposeRotate0 and SimdTransformTransposeRotate180 the output image width and height are equal to input height and width.

Note
This function has a C++ wrappers: Simd::TransformImage(const View<A> & src, ::SimdTransformType transform, View<A> & dst).
Parameters
[in]src- a pointer to pixels data of input image.
[in]srcStride- a row size of input image.
[in]width- an input image width.
[in]height- an input image height.
[in]pixelSize- a pixel size in input and output images. It can be 1, 2, 3, 4.
[in]transform- a type of image transformation.
[out]dst- a pointer to pixels data of output image.
[in]dstStride- a row size of output image.

◆ TransformSize()

Point< ptrdiff_t > TransformSize ( const Point< ptrdiff_t > &  size,
::SimdTransformType  transform 
)

Gets size of transformed image.

Parameters
[in]size- a size of input image.
[in]transform- a type of image transformation.
Returns
- the size of transformed image.

◆ TransformImage()

void TransformImage ( const View< A > &  src,
::SimdTransformType  transform,
View< A > &  dst 
)

Performs transformation of input image. The type of transformation is defined by SimdTransformType enumeration.

Note
This function is a C++ wrapper for function SimdTransformImage.
Parameters
[in]src- an input image.
[in]transform- a type of image transformation.
[out]dst- an output image.