Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Query on ippiRotate_8u_C1R

Arvind_R_1
Beginner
620 Views

Hi,

I am using "ippiRotate_8u_C1R" to rotate one image by 180 degrees. Below find code for the rotation

    //! set centre/shift of rotation for luma
    dShiftX = (double)((usiDstWidth - usiSrcWidth) >> 1);
    dShiftY = (double)((usiDstHeight - usiSrcHeight) >> 1);
    //! set for luma
    ippiAddRotateShift(((double)(usiSrcWidth>>1)), ((double)(usiSrcHeight>>1)), 
	dAngle, &dShiftX, &dShiftY);
    //! call for luma
    iRelVal = ippiRotate_8u_C1R((const Ipp8u*)pucSrc,
        IppiSizeSrc,usiSrcWidth, IppiRectSrcROI,
        (Ipp8u* )pucDst,usiDstWidth,IppiRectDstROI, 
        dAngle, (dShiftX + iDeltaX), (dShiftY + iDeltaY), IPPI_INTER_NN);

Here the source and the destination buffers are of the same size i.e. have the same width and height. This should work since we are trying to rotate the image by 180 degrees. 

If the variables iDeltaX and iDeltaY are both set to 0, we are getting a green path at the output. You can observe green patches on the top and the left borders of the image (refer attached image). 
To resolve the problem, we tried tweaking the values of these variables and had to set both of them to -1 i.e (iDeltaX and iDeltaY are both set to -1) to avoid the green patch. This is the lady on the right hand side of the attached image. 

We would like to understand why do we have to manipulate the dShiftX and dShiftY values in order to get the correct image.

 

0 Kudos
2 Replies
Shaojuan_Z_Intel
Employee
620 Views

Hi Arvind,

I've forwarded your question to our development team. Stay tuned. Thanks!

0 Kudos
Valentin_K_Intel
Employee
620 Views

Hi Arvind,

Does the source image have odd width or height? If so, the operation (usiSrcWidth>>1) or (usiSrcHeight>>1) can lead to a loss of precision.

Best regards,
Valentin

0 Kudos
Reply