FROM : Jean-Daniel Dupas
DATE : Sat May 03 22:33:33 2008
Le 3 mai 08 à 20:06, Josh Burnett a écrit :
> In a photography app, I'm chaining a series of CIFilters together to
> process the image. I'm able to do the chain just fine, but I'm only
> using a few filters at the moment. As I increase the length of this
> chain, am I going to run into performance issues? Here's my code:
>
> exposureFilter = [CIFilter filterWithName: @"CIExposureAdjust"
> keysAndValues:
> @"inputImage", inputImage,
> @"inputEV", [NSNumber numberWithFloat: exposureValue],
> nil];
> outputImage = [exposureFilter valueForKey: @"outputImage"];
> [exposureFilter retain];
>
> zoomFilter = [CIFilter filterWithName: @"CILanczosScaleTransform"
> keysAndValues:
> @"inputImage", outputImage,
> @"inputScale", [NSNumber numberWithFloat: mappedZoom],
> @"inputAspectRatio", [NSNumber numberWithFloat: 1.0],
> nil];
> outputImage = [zoomFilter valueForKey: @"outputImage"];
> [zoomFilter retain];
>
>
> Obviously, it's easy to continue to add to this chain. Is this the
> most efficient way to string multiple filters together? I can
> probably use Quartz Composer to create a single image unit that does
> all of the processing. Would that be any more efficient, or would
> it be essentially the same result?
>
> Thanks,
>
> Josh
On Mac OS 10.5, there is a class designed to create and store filter
chain (CIFilterGenerator). You may have a look at it.
You also have to know that the filter is not computed when you call
[valueForKey:@"outputImage"] but when you try to access the final
outputImage content (to display it for example). Even if this is not
obvious as you have to create a new image instance for each filter,
Core Image optimize the image processing. So creating a single image
unit would probably not be more efficient.
DATE : Sat May 03 22:33:33 2008
Le 3 mai 08 à 20:06, Josh Burnett a écrit :
> In a photography app, I'm chaining a series of CIFilters together to
> process the image. I'm able to do the chain just fine, but I'm only
> using a few filters at the moment. As I increase the length of this
> chain, am I going to run into performance issues? Here's my code:
>
> exposureFilter = [CIFilter filterWithName: @"CIExposureAdjust"
> keysAndValues:
> @"inputImage", inputImage,
> @"inputEV", [NSNumber numberWithFloat: exposureValue],
> nil];
> outputImage = [exposureFilter valueForKey: @"outputImage"];
> [exposureFilter retain];
>
> zoomFilter = [CIFilter filterWithName: @"CILanczosScaleTransform"
> keysAndValues:
> @"inputImage", outputImage,
> @"inputScale", [NSNumber numberWithFloat: mappedZoom],
> @"inputAspectRatio", [NSNumber numberWithFloat: 1.0],
> nil];
> outputImage = [zoomFilter valueForKey: @"outputImage"];
> [zoomFilter retain];
>
>
> Obviously, it's easy to continue to add to this chain. Is this the
> most efficient way to string multiple filters together? I can
> probably use Quartz Composer to create a single image unit that does
> all of the processing. Would that be any more efficient, or would
> it be essentially the same result?
>
> Thanks,
>
> Josh
On Mac OS 10.5, there is a class designed to create and store filter
chain (CIFilterGenerator). You may have a look at it.
You also have to know that the filter is not computed when you call
[valueForKey:@"outputImage"] but when you try to access the final
outputImage content (to display it for example). Even if this is not
obvious as you have to create a new image instance for each filter,
Core Image optimize the image processing. So creating a single image
unit would probably not be more efficient.
| Related mails | Author | Date |
|---|---|---|
| Josh Burnett | May 3, 20:06 | |
| Jean-Daniel Dupas | May 3, 22:33 |






Cocoa mail archive

