- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我已经编写了一个函数来模糊图像,但每 100 个用户中就有 1 个遇到这种崩溃。我无法复制它,也无法调试它。
这是崩溃日志:
Thread : Crashed: com.apple.root.background-qos
0 libGPUSupportMercury.dylib 0x296fb8fe gpus_ReturnNotPermittedKillClient
1 libGPUSupportMercury.dylib 0x296fc3cb gpusSubmitDataBuffers
2 libGPUSupportMercury.dylib 0x296fc249 gldCreateContext
3 GLEngine 0x252ff93b gliCreateContextWithShared
4 OpenGLES 0x253dbab3 -[EAGLContext initWithAPI:properties:] + 406
5 CoreImage 0x2303ba8b ___ZN2CI11can_use_gpuEv_block_invoke + 142
6 libdispatch.dylib 0x307107a7 _dispatch_client_callout + 22
7 libdispatch.dylib 0x307113eb dispatch_once_f + 62
8 CoreImage 0x2303b9fb CI::can_use_gpu() + 98
9 CoreImage 0x22fb9b79 +[CIContext contextWithOptions:] + 188
10 Test 0x0016121b
-[NewRestaurantViewController blur:]
12 libdispatch.dylib 0x307107bb _dispatch_call_block_and_release + 10
13 libdispatch.dylib 0x30719dab _dispatch_root_queue_drain + 866
14 libdispatch.dylib 0x3071acd7 _dispatch_worker_thread3 + 94
15 libsystem_pthread.dylib 0x30871e31 _pthread_wqthread + 668
以下是我的模糊函数:
- (UIImage *)blur:(UIImage*)theImage{
if(theImage == nil){
return theImage;
}
// create our blurred image
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [CIImage imageWithCGImage:theImage.CGImage];
// setting up Gaussian Blur (we could use one of many filters offered by Core Image)
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"];
[filter setDefaults];
[filter setValue:inputImage forKey:@"inputImage"];
[filter setValue:[NSNumber numberWithFloat:10.0f] forKey:@"inputRadius"];
CIImage *result = [filter valueForKey:@"outputImage"];
// CIGaussianBlur has a tendency to shrink the image a little,
// this ensures it matches up exactly to the bounds of our original image
CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]];
UIImage *returnImage = [UIImage imageWithCGImage:cgImage];//create a UIImage for this function to "return" so that ARC can manage the memory of the blur... ARC can't manage CGImageRefs so we need to release it before this function "returns" and ends.
CGImageRelease(cgImage);//release CGImageRef because ARC doesn't manage this on its own.
return returnImage;
}
最佳答案
尝试在实例化 CIContext
之前将 EAGLContext
的当前上下文设置为 nil>
[EAGLContext setCurrentContext:nil];
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *inputImage = [CIImage imageWithCGImage:theImage.CGImage];
关于ios - CIContext 错误访问崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27632618/
所以我正在制作一个应用程序,其中一些主要功能围绕着将 CIFilters 应用于图像。 let context = CIContext() let context = CIContext(eaglCo
我已经编写了一个函数来模糊图像,但每 100 个用户中就有 1 个遇到这种崩溃。我无法复制它,也无法调试它。 这是崩溃日志: Thread : Crashed: com.apple.root.back
我正在寻找等待 CIContext 的方法渲染完成而不会阻塞。为简单起见,这里有一个示例,我渲染了一个 CVPixelBufferRef到另一个 CVPixelBufferRef使用 CIImage和
我正在尝试将CIImage输出到磁盘,并正在寻找最有效的方法。我发现了this question,建议使用CIContext的writeJPEGRepresentation / writePNGRep
我遇到了这种偶尔会发生的奇怪崩溃: 它发生在“drawImage”调用中。 self.glkv?.bindDrawable() self.ciContext?.drawImage(self.curre
我在做什么: 我正在从 AVFoundation 中的 didOutputSampleBuffer 获取 CMSampleBuffer 并运行一些过滤器并将它们输出到 UIImage> 每次代表吐出一
我有一个函数 UIGraphicsBeginImageWithContextWithOptions()和 UIGraphicsEndImageContext( ,但该函数已经传递了一个名为“conte
所以我最近将 iOS 更新到了 9.0.2。我一直在使用 RosyWriter,Apple 的示例使用 CIFilter 和 CIContext 捕获和过滤视频帧。它在 iOS 7 和 8 中运行良好
我只在 iOS 9 上观察到这种行为; iOS 8 正常运行。 我怀疑这可能是 SDK 上的一个错误,我已经向 Apple (22644754) 打开了一个雷达,但我发现它很奇怪,我觉得我可能错过了一
我正在使用找到的解决方案 here使用 CIGaussianBlur 模糊图像。但是,我遇到无法解决的内存泄漏。我最初使用的是不使用 CIContext 作为属性,但认为这可能是无济于事的问题。我还使
作为使用外观设置的一部分,我正在 FinishedLaunching () 中更改图像的色调。当我尝试获取 CIContext 时,应用程序在没有任何崩溃信息的情况下被卸载。 代码如下:
我正在尝试将一个简单的 Core Image Filter 应用于实时摄像机输入。我认为我的代码没问题,但在 captureOutput 方法中使用方法 drawImage:inRect:fromRe
我正在尝试从相机获取视频并使用 CoreImage 和 OpenGL 渲染它。当我运行它时,我在屏幕上看到了我期望的图片,然后我得到了 EXEC_BAD_ACCESS。我正在使用 ARC。 iOS6
如果我像这样初始化 EAGLContext _eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2] 程序
我有一个简单的 Swift 命令行 MacOS 应用程序,我正在努力设置 EAGLContext: let openGLContext = EAGLContext(API: .OpenGLES3) l
经过研究和尝试很多事情后,我终于问自己: 基本上我想选择一张照片,然后将其渲染到 CIcontext,知道许多其他可用的图像渲染技术(例如使用 UIImageView 等),我必须使用低级 OpenG
当使用 CIContext.createCGImgage 时,我在 Xcode 9 上遇到内存泄漏问题。当从相机拍摄图像时,它占用了更多内存,然后应用程序崩溃了 这是我的代码, let ciConte
我用它来生成一个大图像: let context = CIContext(options: nil) let bitmapImage: CGImageRef = context.createCGIma
我在 GLKView 中绘制来自 AVCaptureVideoDataOutput 的相机输出,但相机是 4:3,这与 的纵横比不匹配>GLKView(全屏)。我正在尝试进行纵横比填充,但相机输出似乎
我正在尝试使用以下代码获取 CoreImage CIRandomGenerator 过滤器的输出: CIContext *context = [CIContext contextWithOptions
我是一名优秀的程序员,十分优秀!