Objective C - CIImage / CIFilter / mImageView

Joined
Apr 21, 2010
Messages
2
Reaction score
0
Points
1
Hi, I'm a new user and I'm moving the firsts steps into Objective C. I want to apply some filters (CIFilters) to an image (CIImage) that is contained into a mImageView (IKImageView). How can I do that?

My crazy mind thought to this:


NSArray *filters = nil;
CIFilter *filter = [CIFilter filterWithName:mad:"CIBloom"];
[filter setDefaults];
[filter setValue: [NSNumber numberWithFloat:2.0] forKey:mad:"inputRadius"];
filters = [NSArray arrayWithObject:filter];

CIImage *image; // in this line I don't know what to write...I put it, to intend that I declared a CIImage object
image = [filters valueForKey: @"outputImage"];



But unfortunately it doesn't work....can you help me?

Best Regards

Manu
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I know almost nothing regarding CIImage, but you are at minimum missing;
Code:
[filter setValue: aSourceCIImage forKey:@"inputImage"];
aSourceCIImage being the input image you are trying to manipulate. Other image types have to first be converted to a CIImage type for use in the filter.

I'm not sure what your intent is for the array, but that array will only hold one object since it is not a NSMutableArray.

If you are thinking of chaining multiple filters, I don't think you need an array. As I understand it, you use the output of the previous filter as the input to the next filter. The system will take care of optimizing all of the built up filters.

At the end of the code, you need a way to turn a CIImage into something displayable.

I would look at the Apple documentation and review the samples they link to.
 
Joined
May 26, 2010
Messages
1
Reaction score
0
Points
1
Did you manage to get any further with this?

For the line:

CIImage *image; // in this line I don't know what to write...I put it, to intend that I declared a CIImage object

You can create a new CIImage using:

[CIImage imageWithContentsOfUrl: NSURL * fileURL];

There are many other constructors for the CIImage class too.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top