Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Kadir_Kirtac
Beginner
76 Views

problem about usage of ippiRotateCenter

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
76 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