how to perform Bump Distortion in ios 5.0?
Asked Answered
P

2

0

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];
Psychognosis answered 19/4, 2012 at 13:56 Comment(0)
A
3

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:

Bump distortion

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.

Azine answered 19/4, 2012 at 14:39 Comment(2)
where can i get GPUImage framework i need to perform the similar functionality?Psychognosis
@Spynet - Did you try the link above? github.com/BradLarson/GPUImage You can grab the framework, along with examples that demonstrate this, from GitHub.Azine
B
2

Calling [CIFilter filterNamesInCategory:kCICategoryDistortionEffect] will show you that distortion filters (such as CIBumpDistortion) aren't available at all on iOS.

You can use the same method with kCICategoryBuiltIn to get a list of all filters that are available.

Befit answered 19/4, 2012 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.