UIImage ROI上的高斯模糊不在设备上工作

时间:2012-01-30 19:00:04

标签: ios uiimage blur gaussian

我试图在iphone中模糊部分图像并使用以下代码保存结果:

-(UIImage*) blurROI : (CvRect) roi 
{
    IplImage *img_color = [self CreateIplImageFromUIImage:facePhoto.faceImage];

    //obtain a 4channel RGB reference from the above
    IplImage *img = cvCreateImage(cvGetSize(img_color), IPL_DEPTH_8U, 4);

    //release the source. we don't care any more about it
    cvReleaseImage(&img_color);

    cvSetImageROI(img, roi);
    //make the Blur
    cvSmooth(img, img, CV_GAUSSIAN, 7, 7, 0, 0);

    //return the resulting image
    UIImage *retUIImage = [self UIImageFromIplImage:img];
    return retUIImage;
}

它在模拟器上工作正常但在设备中整个图像变黑。 有什么想法吗?

0 个答案:

没有答案