因为需要将函数进行右转,发现opencv自带 的过于麻烦。自己写了个右转的。可以根据这个想法写出任何方向的
//函数功能,右转图片
IplImage* convertImage(IplImage* image)
{
CvSize size = cvGetSize(image);
IplImage* ori_image = cvCreateImage(cvSize(size.width / , size.height / ), image->depth, image->nChannels);
IplImage* cvt_image = cvCreateImage(cvSize(size.height / , size.width / ), image->depth, image->nChannels);
cvResize(image, ori_image);
int x, y, w;
for (y = ori_image->height; y >= ; y--)
{
uchar* oriptr = (uchar*)(ori_image->imageData + y*ori_image->widthStep);
for (x = ; x < ori_image->width; x++)
{
uchar* curptr = (uchar*)(cvt_image->imageData + x*cvt_image->widthStep);
curptr[ * y] = oriptr[ * x];
curptr[ * y + ] = oriptr[ * x + ];
curptr[ * y + ] = oriptr[ * x + ];
}
}
cvReleaseImage(&image);
cvReleaseImage(&ori_image);
return cvt_image;
}