OpenCV rotation solution?
Posted
by sundowatch
on Stack Overflow
See other posts from Stack Overflow
or by sundowatch
Published on 2010-03-12T08:01:16Z
Indexed on
2010/03/12
22:27 UTC
Read the original article
Hit count: 493
I am using those codes for rotation transforming an image, but it doesn't work. Waht is the problem?
IplImage *src = cvLoadImage("image.jpg",1),
*dst = cvCloneImage(src);
CvMat *rotation_mat = cvCreateMat(2,3,CV_32FC1);
CvPoint2D32f center = cvPoint2D32f(src->width/2 ,src->height/2);
cvZero(dst);
double angle = -50.0,
scale = 0.6;
cv2DRotationMatrix(center, angle, scale, rotation_mat);
cvWarpAffine(src, dst, rotation_mat);
cvNamedWindow("rotation");
cvShowImage("rotation",dst);
cvWaitKey(0);
cvReleaseMat(&rotation_mat);
cvReleaseImage(&src);
cvReleaseImage(&dst);
cvDestroyAllWindows();
return 0;
© Stack Overflow or respective owner