- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
About thefolded line when use ippiRotate or ippiMirror, please see below scene,
with the code of
double xTempShift = 0.0;
double yTempShift = 1.0*w;
IppiRect srcTempRect = { 0, 0,w, h };
IppiRect dstTempRect = { 0, 0,h, w };
status=ippiRotate_8u_C3R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift, IPPI_INTER_NN|IPPI_SMOOTH_EDGE);
Werotatea 227x149 image to 149x227 image.
I add black edge to dst image, so you can see there is the white line on the upper of image clearly.It is the line I mentioned last time.
It is common rounding artefacts because pixel in IPP affine transforms (include rotate operations) is not square but is a point.
For workaround you can just simple to remove it by subtract 1 from yshift or xShift. for example,
status=ippiRotate_8u_C3R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift-1, IPPI_INTER_NN|IPPI_SMOOTH_EDGE);
The line is gone.
(It is just sample,for whois using ippiRotate and has same problem, pleaseconsidersuch kind of modificationbased onyour input image.)
Regards,
Ying
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've never used ippiRotate_... for 90, 180, 270 degree rotations, instead I use a combination of mirror and/or transpose functions. I never had time to check if it was faster than ippiRotate but at least I'm sure to get an exact rotation (no rounding...).
For a 90 degree rotation :
ippiMirror_8u_C1R(pSrc, srcStep, pTempBuffer, srcStep, srcSize, ippAxsHorizontal);
ippiTranspose_8u_C1R(pTempBuffer, srcStep, pDst, dstStep, dstSize);
with dstSize.width = srcSize.height...
For a 270 degree rotation :
ippiTranspose_8u_C1R(pSrc, srcStep, pTempBuffer, dstStep, srcSize);
ippiMirror_8u_C1R(pTempBuffer, dstStep, pDst, dstStep, dstSize, ippAxsHorizontal);
For a 180 degree rotation :
ippiMirror_8u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, ippAxsBoth);
Matthieu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthieu,
Thank you for your suggestion. Yes, we recomment to use ippiMirror to do special rotation like 90,180,270.
To mahantesh,
if use ippiRotate, theno-intergateinterpolation, round issue areunavaidable. ippiRotate provide one parameter IPPI_SMOOTH_EDGE to make edge look better. But the blackstripsmay stillvisiable.how width of the strips in your test? does it affect your result?
Here is small piece of code for your reference.
IppiSize srcTempSize = {w, h};
IppiSizedstTempSize = {h, w};
IppiRect srcTempRect = { 0, 0,w, h };
IppiRect dstTempRect = { 0, 0,h, w };
double xTempShift = 0.0;
double yTempShift = 1.0*w;// conterwise rotate 90 degree, origin (0, 0) will be (0, w) after rotation, so the y shift is w
/*Use this function if you need to rotate an image about an arbitrary center (xCenter, yCenter) rather than the origin (0,0), we will rotate the image by 0, 0 first, so it is not necessary tocall it here
/*
//ippiGetRotateShift(0.0, 0.0, 90.0, &xTempShift, &yTempShift);
ippiSet_8u_C4R ( 0, (Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempSize );
status=ippiRotate_8u_C4R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift, IPPI_INTER_LINEAR|IPPI_SMOOTH_EDGE);
//my test: the rotate operation will show 1 pixel widthblack line on upper of the rotated image)
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthieu,
Thank you for your suggestion. Yes, we recomment to use ippiMirror to do special rotation like 90,180,270.
To mahantesh,
if use ippiRotate, theno-intergateinterpolation, round issue areunavaidable. ippiRotate provide one parameter IPPI_SMOOTH_EDGE to make edge look better. But the blackstripsmay stillvisiable.how width of the strips in your test? does it affect your result?
Here is small piece of code for your reference.
IppiSize srcTempSize = {w, h};
IppiSizedstTempSize = {h, w};
IppiRect srcTempRect = { 0, 0,w, h };
IppiRect dstTempRect = { 0, 0,h, w };
double xTempShift = 0.0;
double yTempShift = 1.0*w;// conterwise rotate 90 degree, origin (0, 0) will be (0, w) after rotation, so the y shift is w
/*Use this function if you need to rotate an image about an arbitrary center (xCenter, yCenter) rather than the origin (0,0), we will rotate the image by 0, 0 first, so it is not necessary tocall it here
/*
//ippiGetRotateShift(0.0, 0.0, 90.0, &xTempShift, &yTempShift);
ippiSet_8u_C4R ( 0, (Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempSize );
status=ippiRotate_8u_C4R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift, IPPI_INTER_LINEAR|IPPI_SMOOTH_EDGE);
//my test: the rotate operation will show 1 pixel widthblack line on upper of the rotated image)
Best Regards,
Ying
Thanks for the pointers to rotate the image. The rotation is working good for all the resolutions except for 160 x 120. Is there anything we need to take care for lower resolutions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Mahantesh,
Which IPP vesion are you using? Thereare some known issue regarding the ippiResize() at
http://software.intel.com/en-us/forums/showthread.php?t=66171
Maybe same. What is symptom when resize the 160x120?
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Mahantesh,
Which IPP vesion are you using? Thereare some known issue regarding the ippiResize() at
http://software.intel.com/en-us/forums/showthread.php?t=66171
Maybe same. What is symptom when resize the 160x120?
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mahantesh,
Thank you for yourreply. I don't rememeber there is known issuefor rotating 160x120 specially.
could yousend me a example?
Best Regards,Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mahantesh,
Thank you for yourreply. I don't rememeber there is known issuefor rotating 160x120 specially.
could yousend me a example?
Best Regards,Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mahantesh,
Did you notice which kind of system (CPU type and OS) have the problem? You may check your cpu type by the way I list in http://software.intel.com/en-us/forums/showthread.php?t=68333 =>item 2
Thanks
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've never used ippiRotate_... for 90, 180, 270 degree rotations, instead I use a combination of mirror and/or transpose functions. I never had time to check if it was faster than ippiRotate but at least I'm sure to get an exact rotation (no rounding...).
For a 90 degree rotation :
ippiMirror_8u_C1R(pSrc, srcStep, pTempBuffer, srcStep, srcSize, ippAxsHorizontal);
ippiTranspose_8u_C1R(pTempBuffer, srcStep, pDst, dstStep, dstSize);
with dstSize.width = srcSize.height...
For a 270 degree rotation :
ippiTranspose_8u_C1R(pSrc, srcStep, pTempBuffer, dstStep, srcSize);
ippiMirror_8u_C1R(pTempBuffer, dstStep, pDst, dstStep, dstSize, ippAxsHorizontal);
For a 180 degree rotation :
ippiMirror_8u_C1R(pSrc, srcStep, pDst, dstStep, roiSize, ippAxsBoth);
Matthieu
We have found that Transpose is faster than Rotate at the 90-degree rotations, and yes, also avoid any potential rounding artefacts. I presume most would want 90-degree rotations to be exact. You can actually improve slightly on the speed by avoiding the Mirroring-calls. This can be done by effectively flipping either the source or the destination image "during" the transposing. This can be done by setting a negative stride and also adjust the associated pointer to point at the start of the last row/line of the image.
Otherwise, you may consider cutting down on memory use by skipping the temporary buffer and do the mirroring in-place in the 'dst' buffer.
Regards,
- Jay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthieu,
Thank you for your suggestion. Yes, we recomment to use ippiMirror to do special rotation like 90,180,270.
To mahantesh,
if use ippiRotate, theno-intergateinterpolation, round issue areunavaidable. ippiRotate provide one parameter IPPI_SMOOTH_EDGE to make edge look better. But the blackstripsmay stillvisiable.how width of the strips in your test? does it affect your result?
Here is small piece of code for your reference.
IppiSize srcTempSize = {w, h};
IppiSizedstTempSize = {h, w};
IppiRect srcTempRect = { 0, 0,w, h };
IppiRect dstTempRect = { 0, 0,h, w };
double xTempShift = 0.0;
double yTempShift = 1.0*w;// conterwise rotate 90 degree, origin (0, 0) will be (0, w) after rotation, so the y shift is w
/*Use this function if you need to rotate an image about an arbitrary center (xCenter, yCenter) rather than the origin (0,0), we will rotate the image by 0, 0 first, so it is not necessary tocall it here
/*
//ippiGetRotateShift(0.0, 0.0, 90.0, &xTempShift, &yTempShift);
ippiSet_8u_C4R ( 0, (Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempSize );
status=ippiRotate_8u_C4R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift, IPPI_INTER_LINEAR|IPPI_SMOOTH_EDGE);
//my test: the rotate operation will show 1 pixel widthblack line on upper of the rotated image)
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
we are facing one problem while rotating image data for 90 degree rotation, please find the code snippet below. Some problem with dstSize in ippiTranspose_8u_C3R() function, this function is crashing. If instead of dstSize, if we pass srcSize, it is working fine.
// destination width and height
dstSize.width = srcSize.height
dstSize.height = srcSize.width
//strides calculation
srcStep = (imageWidth * (bitcount / 8) + 3) & ~3;
dstStep = (imageHeight * (bitcount / 8) + 3) & ~3;
//For a 90 degree rotation :
ippiMirror_8u_C3R(pSrc, srcStep, pTempBuffer, srcStep, srcSize, ippAxsHorizontal);
ippiTranspose_8u_C3R(pTempBuffer, srcStep, pDst, dstStep, dstSize); // crashes here
// if dstSize is replaced by srcSize no crash for 90 degree
//ippiTranspose_8u_C3R(pTempBuffer, srcStep, pDst, dstStep, srcSize); // No crashes here
//For a 270 degree rotation :
ippiTranspose_8u_C3R(pSrc, srcStep, pTempBuffer, dstStep, srcSize);
ippiMirror_8u_C3R(pTempBuffer, dstStep, pDst, dstStep, dstSize, ippAxsHorizontal);
Please let us know if you have faced similar problem or is it the expected behavior that we should pass srcSize where actually we have to pass dstSize or if any resolution for the crash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi mahantesh,
I'mlooking into the ippiRotate issue and get back to you if any findings.
About the ippiTranspose function, right, you should use the size same as the source input, see thedescription of the function' parameter in ippiman.pdf,
roiSize- Size of the source ROI in pixels.
So for 90 degeree rotation,
the pTempBuffer is a source with (srcSize.width, srcSize.heigh), so you will enter srcSize there.
for 270 degree rotation, you call ippiTranspose first,
the pSrc is the input source of the function, so it also needs srcSize.
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
About thefolded line when use ippiRotate or ippiMirror, please see below scene,
with the code of
double xTempShift = 0.0;
double yTempShift = 1.0*w;
IppiRect srcTempRect = { 0, 0,w, h };
IppiRect dstTempRect = { 0, 0,h, w };
status=ippiRotate_8u_C3R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift, IPPI_INTER_NN|IPPI_SMOOTH_EDGE);
Werotatea 227x149 image to 149x227 image.
I add black edge to dst image, so you can see there is the white line on the upper of image clearly.It is the line I mentioned last time.
It is common rounding artefacts because pixel in IPP affine transforms (include rotate operations) is not square but is a point.
For workaround you can just simple to remove it by subtract 1 from yshift or xShift. for example,
status=ippiRotate_8u_C3R ( (Ipp8u*) srcTemp->imageData, srcTempSize, srcTemp->widthStep, srcTempRect,
(Ipp8u*) dstTemp->imageData, dstTemp->widthStep, dstTempRect, 90.0,
xTempShift, yTempShift-1, IPPI_INTER_NN|IPPI_SMOOTH_EDGE);
The line is gone.
(It is just sample,for whois using ippiRotate and has same problem, pleaseconsidersuch kind of modificationbased onyour input image.)
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page