标签:
UIImage *img1 = [UIImage imageNamed:@"1448941176867"];
//将UIImage转换为IplImage格式
IplImage *pimage = [self convertToIplImage:img1];
//缩放图片
//比例值
float fScale = 0.4;
CvSize cvsize;
cvsize.width = pimage->width * fScale;
cvsize.height = pimage ->height * fScale;
//创建输出图像
IplImage *outImage = cvCreateImage(cvsize, pimage->depth, pimage->nChannels);
//缩放图像
cvResize(pimage, outImage);
//将IplImage图像转换为UIImage
UIImage *img = [self convertToUIImage:outImage];
self.imgView.image = img;
//释放图片内存
cvReleaseImage(&pimage);
cvReleaseImage(&outImage);
关于UIImage和IplImage的相互转换,参考我的另一个随笔
http://www.cnblogs.com/iOSDeng/p/5081588.html
标签:
原文地址:http://www.cnblogs.com/iOSDeng/p/5082562.html