Hiya,

thanks for getting back to me!

--- On Mon, 22/12/08, Christopher Wright <[email protected]> wrote:

> From: Christopher Wright <[email protected]>
> Subject: Re: Applying Filter Kernel To Only Part of a Image
> To: "Alex Drinkwater" <[email protected]>
> Cc: "quartzcomposer-dev list list" <[email protected]>
> Date: Monday, 22 December, 2008, 12:42 PM
> > Anyone?
> >> Is it possible using JavaScript in a Core Image
> Filter patch, to apply a kernel function to only a part of
> an input image?
> 
> I don't know about it being possible with JS.  But I
> can go a step lower.
> 
> CoreImage Filters apply to an entire image.  You can set an
> ROI (Region of Interest) to make work on a rectangular
> subregion of the image though.  You can also set a DOD
> (Domain of Definition) to control which parts of the image
> are valid/defined.
> 
> You can set a filter's "shape" with the
> CIFilterShape class, which appears to just represent a
> rectangular region (and only one region, not multiple
> rectangles).

That's actually what I want, but I can't seem to get it to work. See below.

> So it doesn't look like the underlying CoreImage
> functionality supports having filters operate selectively on
> several non-contiguous regions of an input image.  Thus, I
> think it's unlikely that JS will add that automatically.
>  It would have to be a multipass filter step, to process
> each piece.

Ah, that's what I meant, actually. I envisaged a number of passes, with each 
pass only working on a part of the image. The reason for all this is that I 
have a filter that applies a different variation of an equation to each of 4 
vertical strips of the image. I'm trying to avoid using the ternary operator to 
choose which variation to apply, since this results in all 4 variations being 
calculated every every single pixel, which seems massively inefficient.

> An alternative might be to use a mask, and have the
> filter's code honour the mask.  It'll do some extra
> work on the masked out regions (that ultimately have no
> effect), but it might be faster than doing multipass stuff
> in JS/by hand in QC.

That's worth thinking about. I could apply a mask to different sections each 
pass, but I'd still need to comp 4 images together as another pass, something I 
was hoping to avoid.

> Or maybe there's a way to have more than one rectangle,
> but I've not seen that anywhere...

Does the ROI allow the filter to be applied to part of the image, while leaving 
the rest of the image as it was? This is what I had assumed, but my experiments 
so far don't seem to bear that out. Maybe I have this completely wrong..

This jS code in the JS panel of the CIFilter patch

function __image main(__image image, __color color) {
      return multiplyEffect.apply(image.definition, new Vec(0.0, 10.0, 0.0, 
10.0), image, color);
} 

should, I'd have though, only apply the effect to a small part of the image, 
but this doesn't seem to be the case- the effect is applied to the whole image 
area.




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to