首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在CIFilter类中获取过滤器名称列表?

如何在CIFilter类中获取过滤器名称列表?
EN

Stack Overflow用户
提问于 2012-01-27 20:59:43
回答 5查看 29.2K关注 0票数 21

我正在使用下面的代码进行曝光调整和它的工作。我需要锐化,去噪,高亮,色温,阴影,模糊等滤镜名称。

[CIFilter filterWithName: @"CIExposureAdjust"
                      keysAndValues: @"inputImage", [_imageView image], nil];
EN

回答 5

Stack Overflow用户

发布于 2012-01-28 05:50:12

您所需要做的就是向CIFilter索要过滤器名称。然后,您可以向每个筛选器请求其attributes,它返回一个字典,描述筛选器接受的每个输入和输出参数。

NSArray* filters = [CIFilter filterNamesInCategories:nil];
for (NSString* filterName in filters)
{
    NSLog(@"Filter: %@", filterName);
    NSLog(@"Parameters: %@", [[CIFilter filterWithName:filterName] attributes]);
}

例如,这是上述CIZoomBlur筛选器代码的输出:

Filter: CIZoomBlur
Parameters: {
    CIAttributeDescription = "Simulates the effect of zooming the camera while capturing the image.";
    CIAttributeFilterCategories =     (
        CICategoryBlur,
        CICategoryVideo,
        CICategoryStillImage,
        CICategoryBuiltIn
    );
    CIAttributeFilterDisplayName = "Zoom Blur";
    CIAttributeFilterName = CIZoomBlur;
    CIAttributeReferenceDocumentation = "http://developer.apple.com/cgi-bin/apple_ref.cgi?apple_ref=//apple_ref/doc/filter/ci/CIZoomBlur";
    inputAmount =     {
        CIAttributeClass = NSNumber;
        CIAttributeDefault = 20;
        CIAttributeDescription = "The zoom-in amount. Larger values result in more zooming in.";
        CIAttributeDisplayName = Amount;
        CIAttributeIdentity = 0;
        CIAttributeMin = 0;
        CIAttributeSliderMax = 200;
        CIAttributeSliderMin = 0;
        CIAttributeType = CIAttributeTypeDistance;
        CIUIParameterSet = CIUISetBasic;
    };
    inputCenter =     {
        CIAttributeClass = CIVector;
        CIAttributeDefault = "[150 150]";
        CIAttributeDescription = "The x and y position to use as the center of the effect.";
        CIAttributeDisplayName = Center;
        CIAttributeType = CIAttributeTypePosition;
        CIUIParameterSet = CIUISetBasic;
    };
    inputImage =     {
        CIAttributeClass = CIImage;
        CIAttributeDescription = "The image to use as an input image. For filters that also use a background image, this is the foreground image.";
        CIAttributeDisplayName = Image;
        CIUIParameterSet = CIUISetBasic;
    };
    outputImage =     {
        CIAttributeClass = CIImage;
    };
}

不过,在大多数情况下,您可能只会使用the docs

票数 18
EN

Stack Overflow用户

发布于 2013-01-27 20:10:40

也许你可以尝试一下CIFilter类的方法

+ (NSArray *)filterNamesInCategory:(NSString *)category
票数 2
EN

Stack Overflow用户

发布于 2017-02-10 14:43:12

NSLog(@"Distortion: %@", [CIFilter filterNamesInCategory:kCICategoryDistortionEffect]);
NSLog(@"Blurs: %@", [CIFilter filterNamesInCategory:kCICategoryBlur]);
NSLog(@"Color effects: %@", [CIFilter filterNamesInCategory:kCICategoryColorEffect]);
NSLog(@"Color adjustment: %@", [CIFilter filterNamesInCategory:kCICategoryColorAdjustment]);
NSLog(@"Built-in effects: %@", [CIFilter filterNamesInCategory:kCICategoryBuiltIn]);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9033581

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档