how to perform Bump Distortion in ios 5.0?(如何在 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 中执行凹凸失真?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 ios 5.0 中执行凹凸失真?
基础教程推荐
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
