4

我无法让新CIDepthBlurEffect的工作。我做错了什么,还是这是一个已知问题?

下面是我在 Objective-C 中的代码:

    NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSNumber numberWithBool:YES], [NSNumber numberWithBool:YES], nil] forKeys:[NSArray arrayWithObjects:kCIImageAuxiliaryDisparity, @"kCIImageApplyOrientationProperty", nil]];

CIImage *disparityImage = [CIImage imageWithData:imageData options:dict];

CIFilter *ciDepthBlurEffect = [CIFilter filterWithName:@"CIDepthBlurEffect"];
[ciDepthBlurEffect setDefaults];
[ciDepthBlurEffect setValue:disparityImage forKey:@"inputDisparityImage"];
[ciDepthBlurEffect setValue:originalImage forKey:@"inputImage"];
CIImage *outputImage = [ciDepthBlurEffect valueForKey:@"outputImage"];

EAGLContext *previewEaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

CIContext *context = [CIContext contextWithEAGLContext:previewEaglContext options:@{kCIContextWorkingFormat :[NSNumber numberWithInt:kCIFormatRGBAh]} ];

CGImageRef cgimg = [context createCGImage:disparityImage fromRect:[disparityImage extent]];

image = [[UIImage alloc] initWithCGImage:cgimg];

CGImageRelease(cgimg);
4

1 回答 1

0

随着 Xcode 9 beta 2 和 iOS 11 beta 2 的发布,这个问题得到了解决。

于 2017-06-22T09:11:16.893 回答