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

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

问题描述

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



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



一些在ios 5.0中无效的帖子节目,
任何其他方式都可以执行凹凸失真...



提前致谢....



问候,



Spynet



我的代码......

  context = [CIContext contextWithOptions :零]; 
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开始缺失。



但是,您可以使用我的中展示了您可以使用此框架执行的其他一些扭曲。


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天全站免登陆