Simd Library Documentation.

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

Functions for image resizing. More...

Enumerations

enum  SimdResizeChannelType {
  SimdResizeChannelByte ,
  SimdResizeChannelShort ,
  SimdResizeChannelFloat ,
  SimdResizeChannelBf16
}
 
enum  SimdResizeMethodType {
  SimdResizeMethodNearest ,
  SimdResizeMethodNearestPytorch ,
  SimdResizeMethodBilinear ,
  SimdResizeMethodBilinearCaffe ,
  SimdResizeMethodBilinearPytorch ,
  SimdResizeMethodBilinearOpenCv ,
  SimdResizeMethodBicubic ,
  SimdResizeMethodArea ,
  SimdResizeMethodAreaFast
}
 

Functions

SIMD_API void SimdReduceColor2x2 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, size_t channelCount)
 Reduces a multi-channel 8-bit image by two using a 2x2 averaging window. More...
 
SIMD_API void SimdReduceGray2x2 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Reduces an 8-bit gray image by two using a 2x2 averaging window. More...
 
SIMD_API void SimdReduceGray3x3 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, int compensation)
 Reduces an 8-bit gray image by two using a separable 3x3 Gaussian window. More...
 
SIMD_API void SimdReduceGray4x4 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Reduces an 8-bit gray image by two using a separable 4x4 Gaussian-like window. More...
 
SIMD_API void SimdReduceGray5x5 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride, int compensation)
 Reduces an 8-bit gray image by two using a separable 5x5 Gaussian window. More...
 
SIMD_API void * SimdResizerInit (size_t srcX, size_t srcY, size_t dstX, size_t dstY, size_t channels, SimdResizeChannelType type, SimdResizeMethodType method)
 Creates a reusable image resize context. More...
 
SIMD_API void SimdResizerRun (const void *resizer, const uint8_t *src, size_t srcStride, uint8_t *dst, size_t dstStride)
 Resizes one image using a context created by SimdResizerInit. More...
 
SIMD_API void SimdStretchGray2x2 (const uint8_t *src, size_t srcWidth, size_t srcHeight, size_t srcStride, uint8_t *dst, size_t dstWidth, size_t dstHeight, size_t dstStride)
 Stretches an 8-bit gray image by two in both dimensions using pixel replication. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray2x2 (const View< A > &src, View< A >const &dst)
 Reduces an 8-bit gray image by two using a 2x2 averaging window. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray3x3 (const View< A > &src, View< A > &dst, bool compensation=true)
 Reduces an 8-bit gray image by two using a separable 3x3 Gaussian window. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray4x4 (const View< A > &src, View< A > &dst)
 Reduces an 8-bit gray image by two using a separable 4x4 Gaussian-like window. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray5x5 (const View< A > &src, View< A > &dst, bool compensation=true)
 Reduces an 8-bit gray image by two using a separable 5x5 Gaussian window. More...
 
template<template< class > class A>
SIMD_INLINE void ReduceGray (const View< A > &src, View< A > &dst, ::SimdReduceType reduceType, bool compensation=true)
 Reduces an 8-bit gray image by two with a selected averaging / Gaussian window. More...
 
template<template< class > class A>
SIMD_INLINE void Reduce2x2 (const View< A > &src, View< A > &dst)
 Reduces a multi-channel 8-bit image by two using a 2x2 averaging window. More...
 
template<template< class > class A>
SIMD_INLINE void Resize (const View< A > &src, View< A > &dst, ::SimdResizeMethodType method=::SimdResizeMethodBilinear)
 Resizes an image to the destination size using the selected interpolation method. More...
 
template<template< class > class A>
SIMD_INLINE void Resize (const View< A > &src, View< A > &dst, const Point< ptrdiff_t > &size, ::SimdResizeMethodType method=::SimdResizeMethodBilinear)
 Resizes an image to the given size using the selected interpolation method. More...
 
template<template< class > class A>
SIMD_INLINE void StretchGray2x2 (const View< A > &src, View< A > &dst)
 Stretches an 8-bit gray image by two in both dimensions using pixel replication. More...
 

Detailed Description

Functions for image resizing.

Enumeration Type Documentation

◆ SimdResizeChannelType

Describes the scalar data type of each image channel used by SimdResizerInit.

Strides passed to SimdResizerRun are always in bytes. The total pixel size is the channel size selected here multiplied by the channel count passed to SimdResizerInit.

Enumerator
SimdResizeChannelByte 

8-bit unsigned integer channel; one byte per channel.

SimdResizeChannelShort 

16-bit integer channel; two bytes per channel.

SimdResizeChannelFloat 

32-bit floating point channel; four bytes per channel.

SimdResizeChannelBf16 

16-bit BFloat16 (Brain Floating Point) channel; two bytes per channel.

◆ SimdResizeMethodType

Describes interpolation and coordinate mapping methods used by SimdResizerInit.

Supported method/channel combinations are implementation-dependent: nearest methods support all channel types; bilinear supports byte, short, float and BFloat16 channels; Caffe/PyTorch bilinear variants support float and BFloat16 channels; OpenCV bilinear, bicubic, area and area-fast variants support byte channels.

Enumerator
SimdResizeMethodNearest 

Nearest-neighbor resize with default Simd coordinate mapping.

SimdResizeMethodNearestPytorch 

Nearest-neighbor resize with PyTorch-compatible coordinate mapping.

SimdResizeMethodBilinear 

Bilinear interpolation with default Simd coordinate mapping.

SimdResizeMethodBilinearCaffe 

Bilinear interpolation with Caffe-compatible coordinate mapping; used for float and BFloat16 channels.

SimdResizeMethodBilinearPytorch 

Bilinear interpolation with PyTorch-compatible coordinate mapping; used for float and BFloat16 channels.

SimdResizeMethodBilinearOpenCv 

Bilinear interpolation with OpenCV-compatible byte arithmetic and coordinate mapping.

SimdResizeMethodBicubic 

Bicubic interpolation for byte channels.

SimdResizeMethodArea 

Area resize for byte channels.

SimdResizeMethodAreaFast 

Fast area resize for byte-channel downscaling; uses a 2x2 path when the scale permits it.

Function Documentation

◆ SimdReduceColor2x2()

void SimdReduceColor2x2 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
size_t  channelCount 
)

Reduces a multi-channel 8-bit image by two using a 2x2 averaging window.

The output size must be: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2. The channel count must be 1, 2, 3 or 4. Border pixels are replicated when the source width or height is odd.

For all points:

sx0 = 2*x; sx1 = Min(2*x + 1, srcWidth - 1);
sy0 = 2*y; sy1 = Min(2*y + 1, srcHeight - 1);
dst[x, y, c] = (src[sx0, sy0, c] + src[sx1, sy0, c] +
                src[sx0, sy1, c] + src[sx1, sy1, c] + 2)/4;
Note
This function has a C++ wrapper: Simd::Reduce2x2(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]channelCount- a number of channels for input and output images.

◆ SimdReduceGray2x2()

void SimdReduceGray2x2 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Reduces an 8-bit gray image by two using a 2x2 averaging window.

The output size must be: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2. Border pixels are replicated when the source width or height is odd.

For all points:

sx0 = 2*x; sx1 = Min(2*x + 1, srcWidth - 1);
sy0 = 2*y; sy1 = Min(2*y + 1, srcHeight - 1);
dst[x, y] = (src[sx0, sy0] + src[sx1, sy0] + src[sx0, sy1] + src[sx1, sy1] + 2)/4;
Note
This function has a C++ wrapper: Simd::ReduceGray2x2(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.

◆ SimdReduceGray3x3()

void SimdReduceGray3x3 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
int  compensation 
)

Reduces an 8-bit gray image by two using a separable 3x3 Gaussian window.

The output size must be: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2. The filter uses kernel [1 2 1] horizontally and vertically. Source coordinates outside the image are clamped to the nearest valid pixel. If compensation is non-zero, the sum is rounded by adding 8 before division by 16; otherwise it is truncated.

For every point:

k = [1, 2, 1];
sx(i) = Clamp(2*x + i - 1, 0, srcWidth - 1);
sy(j) = Clamp(2*y + j - 1, 0, srcHeight - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 3;
dst[x, y] = (sum + (compensation ? 8 : 0)) / 16;
Note
This function has a C++ wrapper: Simd::ReduceGray3x3(const View<A>& src, View<A>& dst, bool compensation).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]compensation- a flag to enable rounding compensation before division.

◆ SimdReduceGray4x4()

void SimdReduceGray4x4 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Reduces an 8-bit gray image by two using a separable 4x4 Gaussian-like window.

The output size must be: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2. The filter uses kernel [1 3 3 1] horizontally and vertically and rounds by adding 32 before division by 64. Source coordinates outside the image are clamped to the nearest valid pixel.

For every point:

k = [1, 3, 3, 1];
sx(i) = Clamp(2*x + i - 1, 0, srcWidth - 1);
sy(j) = Clamp(2*y + j - 1, 0, srcHeight - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 4;
dst[x, y] = (sum + 32) / 64;
Note
This function has a C++ wrapper: Simd::ReduceGray4x4(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.

◆ SimdReduceGray5x5()

void SimdReduceGray5x5 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride,
int  compensation 
)

Reduces an 8-bit gray image by two using a separable 5x5 Gaussian window.

The output size must be: dstWidth = (srcWidth + 1)/2, dstHeight = (srcHeight + 1)/2. The filter uses kernel [1 4 6 4 1] horizontally and vertically. Source coordinates outside the image are clamped to the nearest valid pixel. If compensation is non-zero, the sum is rounded by adding 128 before division by 256; otherwise it is truncated.

For every point:

k = [1, 4, 6, 4, 1];
sx(i) = Clamp(2*x + i - 2, 0, srcWidth - 1);
sy(j) = Clamp(2*y + j - 2, 0, srcHeight - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 5;
dst[x, y] = (sum + (compensation ? 128 : 0)) / 256;
Note
This function has a C++ wrapper: Simd::ReduceGray5x5(const View<A>& src, View<A>& dst, bool compensation).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image.
[out]dst- a pointer to pixels data of the reduced output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image.
[in]compensation- a flag to enable rounding compensation before division.

◆ SimdResizerInit()

void * SimdResizerInit ( size_t  srcX,
size_t  srcY,
size_t  dstX,
size_t  dstY,
size_t  channels,
SimdResizeChannelType  type,
SimdResizeMethodType  method 
)

Creates a reusable image resize context.

The context stores source size, destination size, channel count, channel type and resize method. It precomputes interpolation indices and coefficients used by SimdResizerRun. Supported combinations are selected from real implementations: nearest methods for all channel types; bilinear for byte, short, float and BFloat16 channels; OpenCV-compatible bilinear, bicubic and area methods for byte channels; Caffe and PyTorch bilinear variants for float and BFloat16 channels. Unsupported combinations return NULL.

Usage example (resize of RGBA64 image):

void * resizer = SimdResizerInit(srcX, srcY, dstX, dstY, 4, SimdResizeChannelShort, SimdResizeMethodBilinear);
if (resizer)
{
     SimdResizerRun(resizer, (uint8_t*)src, srcStride, (uint8_t*)dst, dstStride);
     SimdRelease(resizer);
}
Parameters
[in]srcX- a width of the input image.
[in]srcY- a height of the input image.
[in]dstX- a width of the output image.
[in]dstY- a height of the output image.
[in]channels- a number of channels in input and output images.
[in]type- a type of input and output image channel (see SimdResizeChannelType).
[in]method- a resize method (see SimdResizeMethodType).
Returns
a pointer to resize context. On error or unsupported parameter combination it returns NULL. This pointer is used by function SimdResizerRun. It must be released with function SimdRelease.

◆ SimdResizerRun()

void SimdResizerRun ( const void *  resizer,
const uint8_t *  src,
size_t  srcStride,
uint8_t *  dst,
size_t  dstStride 
)

Resizes one image using a context created by SimdResizerInit.

The input and output images must have the sizes, channel count, channel type and resize method stored in resizer. Strides are specified in bytes. The context can be reused for multiple images with the same geometry and format parameters.

Parameters
[in]resizer- a resize context. It must be created by function SimdResizerInit and released by function SimdRelease.
[in]src- a pointer to pixels data of the original input image.
[in]srcStride- a row size (in bytes) of the input image.
[out]dst- a pointer to pixels data of the resized output image.
[in]dstStride- a row size (in bytes) of the output image.

◆ SimdStretchGray2x2()

void SimdStretchGray2x2 ( const uint8_t *  src,
size_t  srcWidth,
size_t  srcHeight,
size_t  srcStride,
uint8_t *  dst,
size_t  dstWidth,
size_t  dstHeight,
size_t  dstStride 
)

Stretches an 8-bit gray image by two in both dimensions using pixel replication.

The output size must be exactly: dstWidth = 2*srcWidth, dstHeight = 2*srcHeight. For every source pixel:

dst[2*x + 0, 2*y + 0] = src[x, y];
dst[2*x + 1, 2*y + 0] = src[x, y];
dst[2*x + 0, 2*y + 1] = src[x, y];
dst[2*x + 1, 2*y + 1] = src[x, y];
Note
This function has a C++ wrappers: Simd::StretchGray2x2(const View<A>& src, View<A>& dst).
Parameters
[in]src- a pointer to pixels data of the original input image.
[in]srcWidth- a width of the input image.
[in]srcHeight- a height of the input image.
[in]srcStride- a row size of the input image in bytes.
[out]dst- a pointer to pixels data of the stretched output image.
[in]dstWidth- a width of the output image.
[in]dstHeight- a height of the output image.
[in]dstStride- a row size of the output image in bytes.

◆ ReduceGray2x2()

void ReduceGray2x2 ( const View< A > &  src,
View< A >const &  dst 
)

Reduces an 8-bit gray image by two using a 2x2 averaging window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. Border pixels are replicated when the source width or height is odd.

For all points:

sx0 = 2*x; sx1 = Min(2*x + 1, src.width - 1);
sy0 = 2*y; sy1 = Min(2*y + 1, src.height - 1);
dst[x, y] = (src[sx0, sy0] + src[sx1, sy0] + src[sx0, sy1] + src[sx1, sy1] + 2)/4;
Note
This function is a C++ wrapper for function SimdReduceGray2x2.
Parameters
[in]src- an original input 8-bit gray image.
[out]dst- a reduced output 8-bit gray image.

◆ ReduceGray3x3()

void ReduceGray3x3 ( const View< A > &  src,
View< A > &  dst,
bool  compensation = true 
)

Reduces an 8-bit gray image by two using a separable 3x3 Gaussian window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. The filter uses kernel [1 2 1] horizontally and vertically. Source coordinates outside the image are clamped to the nearest valid pixel. If compensation is true, the sum is rounded by adding 8 before division by 16; otherwise it is truncated.

For every point:

k = [1, 2, 1];
sx(i) = Clamp(2*x + i - 1, 0, src.width - 1);
sy(j) = Clamp(2*y + j - 1, 0, src.height - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 3;
dst[x, y] = (sum + (compensation ? 8 : 0)) / 16;
Note
This function is a C++ wrapper for function SimdReduceGray3x3.
Parameters
[in]src- an original input 8-bit gray image.
[out]dst- a reduced output 8-bit gray image.
[in]compensation- a flag to enable rounding compensation before division. It is equal to true by default.

◆ ReduceGray4x4()

void ReduceGray4x4 ( const View< A > &  src,
View< A > &  dst 
)

Reduces an 8-bit gray image by two using a separable 4x4 Gaussian-like window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. The filter uses kernel [1 3 3 1] horizontally and vertically and rounds by adding 32 before division by 64. Source coordinates outside the image are clamped to the nearest valid pixel.

For every point:

k = [1, 3, 3, 1];
sx(i) = Clamp(2*x + i - 1, 0, src.width - 1);
sy(j) = Clamp(2*y + j - 1, 0, src.height - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 4;
dst[x, y] = (sum + 32) / 64;
Note
This function is a C++ wrapper for function SimdReduceGray4x4.
Parameters
[in]src- an original input 8-bit gray image.
[out]dst- a reduced output 8-bit gray image.

◆ ReduceGray5x5()

void ReduceGray5x5 ( const View< A > &  src,
View< A > &  dst,
bool  compensation = true 
)

Reduces an 8-bit gray image by two using a separable 5x5 Gaussian window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. The filter uses kernel [1 4 6 4 1] horizontally and vertically. Source coordinates outside the image are clamped to the nearest valid pixel. If compensation is true, the sum is rounded by adding 128 before division by 256; otherwise it is truncated.

For every point:

k = [1, 4, 6, 4, 1];
sx(i) = Clamp(2*x + i - 2, 0, src.width - 1);
sy(j) = Clamp(2*y + j - 2, 0, src.height - 1);
sum = Sum(k[i]*k[j]*src[sx(i), sy(j)]), 0 <= i,j < 5;
dst[x, y] = (sum + (compensation ? 128 : 0)) / 256;
Note
This function is a C++ wrapper for function SimdReduceGray5x5.
Parameters
[in]src- an original input 8-bit gray image.
[out]dst- a reduced output 8-bit gray image.
[in]compensation- a flag to enable rounding compensation before division. It is equal to true by default.

◆ ReduceGray()

void ReduceGray ( const View< A > &  src,
View< A > &  dst,
::SimdReduceType  reduceType,
bool  compensation = true 
)

Reduces an 8-bit gray image by two with a selected averaging / Gaussian window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. The reduceType argument selects one of the specialized reducers: SimdReduce2x2, SimdReduce3x3, SimdReduce4x4 or SimdReduce5x5. The compensation flag is used only for SimdReduce3x3 and SimdReduce5x5.

Parameters
[in]src- an original input 8-bit gray image.
[out]dst- a reduced output 8-bit gray image.
[in]reduceType- a type of function used for image reducing (see SimdReduceType).
[in]compensation- a flag to enable rounding compensation before division. It is relevant only for SimdReduce3x3 and SimdReduce5x5. It is equal to true by default.

◆ Reduce2x2()

void Reduce2x2 ( const View< A > &  src,
View< A > &  dst 
)

Reduces a multi-channel 8-bit image by two using a 2x2 averaging window.

The output size must be: dst.width = (src.width + 1)/2, dst.height = (src.height + 1)/2. Both images must have the same format with 1, 2, 3 or 4 channels of 8-bit depth. Border pixels are replicated when the source width or height is odd. Every channel is averaged independently.

For all points:

sx0 = 2*x; sx1 = Min(2*x + 1, src.width - 1);
sy0 = 2*y; sy1 = Min(2*y + 1, src.height - 1);
dst[x, y, c] = (src[sx0, sy0, c] + src[sx1, sy0, c] +
                src[sx0, sy1, c] + src[sx1, sy1, c] + 2)/4;
Note
This function is a C++ wrapper for function SimdReduceColor2x2.
Parameters
[in]src- an original input image.
[out]dst- a reduced output image.

◆ Resize() [1/2]

void Resize ( const View< A > &  src,
View< A > &  dst,
::SimdResizeMethodType  method = ::SimdResizeMethodBilinear 
)

Resizes an image to the destination size using the selected interpolation method.

Source and destination must have the same pixel format. Supported channel types are 8-bit byte (1..4 channels), 16-bit short and 32-bit float. If the images already have the same size, the function copies the source to the destination. Otherwise it creates a temporary resize context (SimdResizerInit / SimdResizerRun) for the requested method (see SimdResizeMethodType). Unsupported format/method combinations are rejected.

Note
This function is a C++ wrapper for functions SimdResizerInit and SimdResizerRun.
Parameters
[in]src- an original input image.
[out]dst- a resized output image with the desired size and the same format as src.
[in]method- a resizing method. By default it is equal to SimdResizeMethodBilinear.

◆ Resize() [2/2]

void Resize ( const View< A > &  src,
View< A > &  dst,
const Point< ptrdiff_t > &  size,
::SimdResizeMethodType  method = ::SimdResizeMethodBilinear 
)

Resizes an image to the given size using the selected interpolation method.

The destination may be the same object as the source (in-place resize). If dst already has a different size, it is recreated with the source format. The actual interpolation is performed by the overload Resize(const View<A>&, View<A>&, ::SimdResizeMethodType).

Note
This function is a C++ wrapper for functions SimdResizerInit and SimdResizerRun.
Parameters
[in]src- an original input image.
[out]dst- a resized output image. The input image can be the output.
[in]size- a size of the output image.
[in]method- a resizing method. By default it is equal to SimdResizeMethodBilinear.

◆ StretchGray2x2()

void StretchGray2x2 ( const View< A > &  src,
View< A > &  dst 
)

Stretches an 8-bit gray image by two in both dimensions using pixel replication.

Both images must have 8-bit gray format. The output size must be exactly: dst.width = 2*src.width, dst.height = 2*src.height. For every source pixel:

dst[2*x + 0, 2*y + 0] = src[x, y];
dst[2*x + 1, 2*y + 0] = src[x, y];
dst[2*x + 0, 2*y + 1] = src[x, y];
dst[2*x + 1, 2*y + 1] = src[x, y];
Note
This function is a C++ wrapper for function SimdStretchGray2x2.
Parameters
[in]src- an original 8-bit gray input image.
[out]dst- a stretched 8-bit gray output image.