Shear

Performs shearing transform of the source image.

Syntax

Case 1: Operation on pixel-order data

IppStatus ippiShear_<mod>(const Ipp<datatype>* pSrc, IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* pDst, int dstStep, IppiRect dstRoi, double xShear, double yShear, double xShift, double yShift, int interpolation);

Supported values for mod:

8u_C1R

16u_C1R

32f_C1R

64f_C1R

8u_C3R

16u_C3R

32f_C3R

64f_C3R

8u_C4R

16u_C4R

32f_C4R

64f_C4R

8u_AC4R

16u_AC4R

32f_AC4R

64f_AC4R

Case 2: Operation on planar-order data

IppStatus ippiShear_<mod>(const Ipp<datatype>* const pSrc[3], IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* const pDst[3], int dstStep, IppiRect dstRoi, double xShear, double yShear, double xShift, double yShift, int interpolation);

Supported values for mod:

8u_P3R

16u_P3R

32f_P3R

64f_P3R

IppStatus ippiShear_<mod>(const Ipp<datatype>* const pSrc[4], IppiSize srcSize, int srcStep, IppiRect srcRoi, Ipp<datatype>* const pDst[4], int dstStep, IppiRect dstRoi, double xShear, double yShear, double xShift, double yShift, int interpolation);

Supported values for mod:

8u_P4R

16u_P4R

32f_P4R

64f_P4R

Parameters

pSrc

Pointer to the source image origin. An array of separate pointers to each plane for data in planar format.

srcSize

Size in pixels of the source image.

srcStep

Distance in bytes between starts of consecutive lines in the source image buffer.

srcRoi

Region of interest in the source image (of the IppiRect type).

pDst

Pointer to the destination image origin. An array of separate pointers to each plane for data in planar format.

dstStep

Distance in bytes between starts of consecutive lines in the destination image buffer.

dstRoi

Region of interest in the destination image (of the IppiRect type).

xShear, yShear

Coefficients of the shearing transform.

xShift, yShift

Additional shift values along the horizontal and vertical axes.

interpolation

Specifies the interpolation mode. Possible values are:

IPPI_INTER_NN - nearest neighbor interpolation

IPPI_INTER_LINEAR - linear interpolation

IPPI_INTER_CUBIC - cubic interpolation

IPPI_INTER_CUBIC2P_CATMULLROM - Catmull-Rom spline

the following flag is used additionally to the above modes:

IPPI_SMOOTH_EDGE - edge smoothing

Description

The function ippiShear is declared in the ippi.h file. It operates with ROI (see ROI Processing in Geometric Transforms).

This function performs shearing transform - it maps the source image pixel coordinates (x,y) according to the following formulas:

x' = x + xShear * y + xShift

y' = yShear *x + y + yShift ,

where x' and y' denote the pixel coordinates in the sheared image. The shearing transform is a special case of an affine transform, performed by the ippiWarpAffine function.

The transformed part of the image is resampled using the interpolation mode specified by the interpolation parameter, and written to the destination image ROI.

Figure “Shearing a Sample Image” gives an example of applying the shearing transform function ippiShear to a sample image.

Shearing a Sample Image

Example “Using the function ippiShear” shows how to use the function ippiShear_8u_C1R.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointers is NULL.

ippStsSizeErr

Indicates an error condition if any image dimension has zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep or dstStep has a zero or negative value.

ippStsInterpolationErr

Indicates an error condition if interpolation has an illegal value.

ippStsCoeffErr

Indicates an error condition if xShear*yShear = 1.

ippStsRectErr

Indicates an error condition if width or height of the intersection of the srcRoi and source image is less than or equal to 1.

ippStsWrongIntersectROIErr

Indicates an error condition if srcRoi has no intersection with the source image.

ippStsWrongIntersectQuad

Indicates a warning that no operation is performed if the transformed source ROI has no intersection with the destination ROI.

Using the function ippiShear

IppiSize srcSize = { 4, 4 };
IppiSize dstSize = { 7, 4 };
IppiRect srcRect = { 0, 0, 4, 4};
IppiRect dstRect = { 0, 0, 7, 4};
Ipp8u    src[4*4] = { 4, 4, 4, 4,
          3, 3, 3, 3,
          2, 2, 2, 2,
          1, 1, 1, 1 };
Ipp8u  dst[7*4];
double xShear = -1.0;
double yShear = 0.0;
double xShift = 3.0;
double yShift = 0.0;

ippiSet_8u_C1R (0, dst, 7, dstSize);
ippiShear_8u_C1R (src,srcSize, 4, srcRect, dst, 7, dstRect,  xShear, 
                    yShear,  xShift,  yShift,  IPPI_INTER_NN );
 
result:
4 4 4 4
3 3 3 3   src
2 2 2 2
1 1 1 1
 
0 0 0 4 4 4 4
0 0 3 3 3 3 0
0 2 2 2 2 0 0   dst
1 1 1 1 0 0 0
 

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.