Caricature in iOS [closed]

隐身守侯 提交于 2019-12-23 06:34:08

问题


I am trying to apply caricature effect to photos in iOS. I googled for so many things but found very things for it. I have checked https://github.com/BradLarson/GPUImage for to get sketch of an image so that I can apply various filters on sketch. But still stuck in it. I have seen this link also Create Sketch effect to photos using Brad Larson GPUImage in Obj C but unable to get proper combination for it. Please help me if you found something similar thing.

Thanks in advance.


回答1:


I have never heard of a caricature filter being part of the iOS. That's probably going to be a custom design. There are however a truck load of built in filters which are part of the iOS. Run this little script to get a complete listing of all CoreImage filters part of iOS6:

NSArray *ciFilters = [CIFilter filterNamesInCategory:kCICategoryBuiltIn];
for (NSString *filter in ciFilters) {
NSLog(@"filter name %@", filter);
NSLog(@"filter %@", [[CIFilter filterWithName:filter] attributes]);
}

and remember to add CoreImage to your project framework.

EDIT: Try this function as an edge detection filter:

-(CIImage *)simpleEdgeDetection:(CIImage *)inputImage {
CIFilter *desaturate = [CIFilter filterWithName:@"CIColorControls"];
[desaturate setValue:inputImage forKey:kCIInputImageKey];
[desaturate setValue:@0.0f forKey:@"inputSaturation"];
CIFilter *blur = [CIFilter filterWithName:@"CIGaussianBlur"];
[blur setValue:desaturate.outputImage forKey:kCIInputImageKey];
[blur setValue:@3.0f forKey:@"inputRadius"];
CIFilter *inverted = [CIFilter filterWithName:@"CIColorInvert"];
[inverted setValue:blur.outputImage forKey:kCIInputImageKey];
CIFilter *blendDodge = [CIFilter filterWithName:@"CIColorDodgeBlendMode"];
[blendDodge setValue:inverted.outputImage forKey:kCIInputBackgroundImageKey];
[blendDodge setValue:desaturate.outputImage forKey:kCIInputImageKey];
CIFilter *blendBurn = [CIFilter filterWithName:@"CIColorDodgeBlendMode"];
[blendBurn setValue:blendDodge.outputImage forKey:kCIInputImageKey];
[blendBurn setValue:inputImage forKey:kCIInputBackgroundImageKey];
return blendBurn.outputImage;

}

It is from the iOS6 Tutorial - www.raywenderlich.com



来源:https://stackoverflow.com/questions/16773356/caricature-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!