如何在 ios 5.0 中执行凹凸失真? [英] how to perform Bump Distortion in ios 5.0?

查看:16
本文介绍了如何在 ios 5.0 中执行凹凸失真?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 ios 5.0 中执行 Bump Distortion...我的 xcode 没有显示任何错误,而且我没有得到任何输出......在跟踪并打印 凹凸过滤器 实例时,它会打印空值...

关于这个的任何想法......

一些帖子显示在 ios 5.0 中无法使用,还有其他方法可以执行凹凸失真...

提前谢谢....

问候,

间谍网

我的代码...

context = [CIContext contextWithOptions:nil];CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"];[bumpDistortion setValue:ciimage forKey:kCIInputImageKey];[bumpDistortion setValue:[CIVector vectorWithX:200 Y:150] forKey:@"inputCenter"];[bumpDistortion setValue:[NSNumber numberWithFloat:100] forKey:@"inputRadius"];[bumpDistortion setValue:[NSNumber numberWithFloat:3.0] forKey:@"inputScale"];CIImage *imageOutput = [bumpDistortion outputImage];CGImageRef cgimg = [context createCGImage:imageOutput fromRect:[imageOutput extent]];UIImage *newImg = [UIImage imageWithCGImage:cgimg];[self.imageView setImage:newImg];

解决方案

正如 omz 指出的那样,从 iOS 5.1 开始,这个特殊的 Core Image 过滤器就没有了.

但是,您可以使用我的 中展示了您可以使用此框架执行的其他一些变形.

i need to perform Bump Distortion in ios 5.0... my xcode doesn't show any error and also i am not get any output ... while trace and print the Bump filter instance it prints the null value...

any idea about that...

some of the post shows that was not work in ios 5.0, any other way is there to perform the Bump Distortion...

Thanks in advance....

Regards,

Spynet

My code...

context = [CIContext contextWithOptions:nil];
     CIFilter *bumpDistortion = [CIFilter filterWithName:@"CIBumpDistortion"];
     [bumpDistortion setValue:ciimage forKey:kCIInputImageKey];
     [bumpDistortion setValue:[CIVector vectorWithX:200 Y:150] forKey:@"inputCenter"];
     [bumpDistortion setValue:[NSNumber numberWithFloat:100] forKey:@"inputRadius"];
     [bumpDistortion setValue:[NSNumber numberWithFloat:3.0] forKey:@"inputScale"];

    CIImage *imageOutput = [bumpDistortion outputImage];

    CGImageRef cgimg = [context createCGImage:imageOutput fromRect:[imageOutput extent]];
    UIImage *newImg = [UIImage imageWithCGImage:cgimg];

    [self.imageView setImage:newImg];

解决方案

As omz points out, this particular Core Image filter is missing as of iOS 5.1.

However, you can easily do this using my GPUImage framework and the GPUImageBulgeDistortionFilter:

For processing a UIImage, and getting a UIImage result, you'd use code like the following:

UIImage *inputImage = [UIImage imageNamed:@"test.jpg"];
GPUImageBulgeDistortionFilter *stillImageFilter = [[GPUImageBulgeDistortionFilter alloc] init];
UIImage *quickFilteredImage = [stillImageFilter imageByFilteringImage:inputImage];

You can also do this on live video or prerecorded movies in realtime.

I show a few other distortions you can perform with this framework in this answer.

这篇关于如何在 ios 5.0 中执行凹凸失真?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆