GetRotateBound

Computes the bounding rectangle for the source ROI transformed by the ippiRotate function.

Syntax

IppStatus ippiGetRotateBound(IppiRect srcRoi, double bound[2][2], double angle, double xShift, double yShift);

Parameters

srcRoi

Source image ROI.

bound

Output array. Contains vertex coordinates of the bounding rectangle for the transformed source ROI.

angle

The angle of rotation in degrees.

xShift, yShift

The shifts along horizontal and vertical axes to perform after the rotation.

Description

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

This function is used as a support function for ippiRotate. It computes vertex coordinates of the smallest bounding rectangle for the quadrangle quad, to which the source ROI is mapped by the ippiRotate function, which rotates an image by angle degrees and shifts it by xShift, yShift. bound[0] specifies x, y coordinates of the top-left corner, bound[1] specifies x, y coordinates of the bottom-right corner.

Example “Using Intel IPP Functions for Image Rotation” shows how to use the function ippiGetRotateBound.

Return Values

ippStsNoErr

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

ippStsSizeErr

Indicates an error condition if srcRoi has a size field with zero or negative value.

Using Intel IPP Functions for Image Rotation

    Ipp8u src[4*4] = {4, 4, 4, 4,
                      3, 3, 3, 3,
                      2, 2, 2, 2,
                      1, 1, 1, 1};
    Ipp8u dst[6*6];
    IppiSize srcSize = { 4, 4 };
    IppiSize dstSize = { 6, 6 };
    IppiRect srcRect = { 0, 0, 4, 4 };
    double xShift;
    double yShift;
    double xCenterSrc = 2.0;
    double yCenterSrc = 2.0;
    double xCenterDst = 3.5;
    double yCenterDst = 2.5;
    double quad[4][2];
    double bound[2][2];
    double angle = 35.0;
 
    ippiGetRotateShift ( xCenterSrc, yCenterSrc, angle, &xShift, &yShift );
    // xShift = -0.7 , yShift = 1.5
 
    ippiAddRotateShift ( 1.0, 1.0, angle, &xShift, &yShift);
    // xShift = -1.1, yShift = 2.2
 
    xShift += xCenterDst - xCenterSrc;
    yShift += yCenterDst - yCenterSrc;
    // xShift = 0.3, yShift = 2.7
 
    ippiGetRotateQuad ( srcRect, quad, angle, xShift, yShift);
    // quad[0] = { 0.3, 2.7 }
    // quad[1] = { 2.7, 1.0 }
    // quad[2] = { 4.5, 3.5 }
    // quad[3] = { 2.0, 5.2 }
 
    ippiGetRotateBound ( srcRect, bound, angle, xShift, yShift);
    // bound[0] = { 0.3, 1.0 }
    // bound[1] = { 4.5, 5.2 }
 
    IppiRect dstRect = { (int)quad[1][0], (int)quad[1][1], (int)quad[3][0], (int)quad[3][1] };
 
    ippiSet_8u_C1R ( 0, dst, 6, dstSize );
    ippiRotate_8u_C1R ( src, srcSize, 4, srcRect, dst, 6, dstRect, angle, xShift, yShift, IPPI_INTER_NN);
 
Result:
4 4 4 4
3 3 3 3
2 2 2 2        src
1 1 1 1
 
0 0 0 0 0 0
0 0 0 0 0 0
0 0 4 3 0 0
0 0 3 2 0 0    dst
0 0 2 1 0 0
0 0 1 0 0 0
 

Submit feedback on this help topic

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