OGeek|极客世界-中国程序员成长平台

标题: ios - iOS中的GPUImage二值化 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 02:30
标题: ios - iOS中的GPUImage二值化

我正在尝试使用 GPUImage 技术使用图像二值化。我写了这些代码行,其中“图像”是灰度图像

 GPUImagePicture *imageSource = [[GPUImagePicture alloc] initWithImage:image];
 GPUImageAdaptiveThresholdFilter *stillImageFilter = [[GPUImageAdaptiveThresholdFilter alloc] 
 init];
 stillImageFilter.blurRadiusInPixels = 3.0;
 [imageSource addTarget:stillImageFilter];
 [imageSource useNextFrameForImageCapture];
 [imageSource processImage];
 UIImage *retImage = [stillImageFilter imageFromCurrentFramebuffer];

我得到“Nil”作为 retImage。我无法弄清楚我的错误。有人帮帮我吗?



Best Answer-推荐答案


你需要在 stillImageFilter 上调用 -useNextFrameForImageCapture,而不是 imageSource。

关于ios - iOS中的GPUImage二值化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26335697/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4