Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

problem about usage of ippiRotateCenter

Kadir_Kirtac
Beginner
153 Views
Hello, I want to rotate an image on its center. I am trying to use ippiRotateCenter. The below code I have written does not perform what I expect. I also attach the input image, the result I get with the below code and the result of matlab's imrotate function. I think matlab's result is ideal. Any idea is welcome.

[bash]    int inputWidth = 512;
    int inputHeight = 512;
    int rotWidth = 725;
    int rotHeight = 725;
    
    double angle = 45.0;

    int stepBytesRot;
    Ipp32f* inputRotated = ippiMalloc_32f_C1(rotWidth, rotHeight, &stepBytesRot);
    IppiSize srcSize = { inputWidth, inputHeight }, dstSize = { rotWidth, rotHeight };

    double xCenter = floor((double)inputWidth/2);
    double yCenter = floor((double)inputHeight/2);

    IppiRect srcRect = { 0, 0, inputWidth, inputHeight};
    IppiRect dstRect = { 0, 0, rotWidth, rotHeight};
    
    int interpolationType = IPPI_INTER_NN;

    sts = ippiRotateCenter_32f_C1R(inputImage, srcSize, stepBytesInput, srcRect,
        inputRotated, stepBytesRot, dstRect,
        -angle, xCenter, yCenter, interpolationType);

    assert(sts!=ippStsNullPtrErr); assert(sts!=ippStsSizeErr); assert(sts!=ippStsStepErr);
    assert(sts!=ippStsInterpolationErr); assert(sts!=ippStsRectErr); assert(sts!=ippStsWrongIntersectQuad);[/bash]


0 Kudos
1 Reply
Yuri_Tikhomirov__Int
New Contributor I
153 Views
Hi Kadir,

The example from IPP Reference Manual will help you. Please look at the attached file.
You should to recalculate dstRect and parameters xShift and yShift using auxiliary functions before call of the function ippiRotate.

Thanks,
Beg
Reply