我正在使用下面的代码进行曝光调整和它的工作。我需要锐化,去噪,高亮,色温,阴影,模糊等滤镜名称。
[CIFilter filterWithName: @"CIExposureAdjust"
keysAndValues: @"inputImage", [_imageView image], nil];
发布于 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。
发布于 2013-01-27 20:10:40
也许你可以尝试一下CIFilter类的方法
+ (NSArray *)filterNamesInCategory:(NSString *)category
发布于 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]);
https://stackoverflow.com/questions/9033581
复制相似问题