Rotate 90 degrees

Rotate 90 degrees

Portrait de Aris Basic

im trying to use RotateCenter to rotate an image in increments of 90 degressbut for some reason im not getting correct image back[cpp] IppiRect srcRect = { 0, 0, 0, 0}; srcRect.width = Width(); srcRect.height = Height(); IppiRect dstRect = { 0, 0, 0 , 0}; dstRect.width = Width(); dstRect.height = Height(); if (abs(angle) == 90 || abs(angle) == 270) std::swap(dstRect.width,dstRect.height); double xCenterSrc = Width()/2.0; double yCenterSrc = Height()/2.0; image.Alloc(dstRect.width,dstRect.height,NChannels(),Precision(),0); image.Color(Color()); image.Format(Format()); if (Precision() any idea what am i doing wrong ?

2 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Pitcha Y.

Hi,

This code is working me. Rotate my bitmap by 90 degrees:

Ipp8u* dstBMP;
dstBMP = ippiMalloc_8u_C3(sizeImPlane.width, sizeImPlane.height, &pStepBMP);
int dw = _WIDTH ;
int dh = _HEIGHT ;
int src_step = _WIDTH * 3;
int dst_step = dw * 3;
IppiSize src_size = { _WIDTH, _HEIGHT };
IppiRect src_roi = { 0, 0, _WIDTH, _HEIGHT };
IppiRect dst_rect = { 0, 0, dw, dh };
double xShift = ((double)dw - (double)_WIDTH) / 2.0;
double yShift = ((double)dh - (double)_HEIGHT) / 2.0;
ippiAddRotateShift((double)_WIDTH / 2, (double)_HEIGHT / 2, 90, &xShift, &yShift);
ippiRotate_8u_C3R(srcBMP, src_size, src_step, src_roi, dstBMP, dst_step, dst_rect, 90, xShift, yShift, IPPI_INTER_NN);

Connectez-vous pour laisser un commentaire.