Quantcast
Channel: Intel® Software - Intel® Integrated Performance Primitives
Viewing all articles
Browse latest Browse all 1489

ippirotate in ipp 9.0

$
0
0

Hi,

i'm trying to migrate to 9.0. I found that ippirotate isno longer available and I found an article how to roate using warping functions. But that does not work. I want to rotate around the image center and the destination image resize is enlarged to show the whole rotated image:

IppiSize srcSize = { i_src.getWidth(), i_src.getHeight() };
  IppiRect srcRect = { 0, 0, i_src.getWidth(), i_src.getHeight() };
  float64 coeffs[2][3];
  float64 bound[2][2];
  float64 shiftX;
  float64 shiftY;
  auto status = ippiGetRotateShift(srcSize.width / 2, srcSize.height / 2, degrees, &shiftX, &shiftY);
  status = ippiGetRotateTransform(degrees, -shiftX, shiftY, coeffs);
  status = ippiGetAffineBound(srcRect, bound, coeffs);
  IppiSize dstSize = { bound[1][0] - bound[0][0] + 1, bound[1][1] - bound[0][1] + 1 };
  cImg dstImg(i_src.getImgType().getTypeId(), dstSize.width, dstSize.height);
  sint32 specSize = 0;
  sint32 bufferSize = 0;
  float64 borderValue[] = { 0 };
  status = ippiWarpAffineGetSize(srcSize, dstSize, ipp8u, coeffs, ippLinear, ippWarpForward, ippBorderConst, &specSize, &bufferSize);
  IppiWarpSpec *spec = reinterpret_cast<IppiWarpSpec *>(ippsMalloc_8u(specSize));
  status = ippiWarpAffineLinearInit(srcSize, dstSize, ipp8u, coeffs, ippWarpForward, 1, ippBorderConst, borderValue, 0, spec);
  m_buffer.resize(bufferSize);
  IppiPoint dstOffset = { 0, 0 };
  status = ippiWarpAffineLinear_8u_C1R(i_src.getPixel<uint8>(0, 0), i_src.getYPitch(),
                                       dstImg.getPixel<uint8>(0, 0), dstImg.getYPitch(), dstOffset, dstSize, spec, m_buffer.data());

 

But the resulting image is wlays slightly outside the image boundaries.


Viewing all articles
Browse latest Browse all 1489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>