在iOS中使用CIEdgeWork过滤器 [英] Using CIEdgeWork Filters in iOS
问题描述
我正在使用Core Image过滤器,并尝试制作CIEdgeWork过滤器。应用滤镜后,图像会变黑。我是否正确初始化了CIFilter。
I am using Core Image filters and trying to make the CIEdgeWork filter. When the filter is applied the image turns black. Am I initializing the CIFilter correctly.
CIFilter *edgeWork = [CIFilter filterWithName:@"CIEdgeWork"
keysAndValues:kCIInputImageKey,filterPreviewImage,
@"inputRadius",[NSNumber numberWithFloat:3.0],
nil];
推荐答案
CIEdgeWork是在iOS的Core Image中不可用,因此您看到这并不奇怪
CIEdgeWork is not available in Core Image on iOS as of iOS 5.x, so it's no surprise that you're seeing a black image when trying to use it.
但是,您可以在我的 GPUImage 框架可实现同样的效果。您可以在此答案。后一种过滤器可能更接近苹果通过CIEdgeWork提供的实际效果,因为它们似乎对生成的边缘检测图像进行了二值化处理。
However, you can use the GPUImageSketchFilter or GPUImageThresholdEdgeDetection from my GPUImage framework to pull off this same effect. You can see the result of the first filter in this answer. The latter filter might be closer to the actual effect that Apple supplies via CIEdgeWork, given that they seem to binarize the resulting edge detected image.
这篇关于在iOS中使用CIEdgeWork过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!