Core Image Filter

Core Image Questions

idlefon's picture

So I've been messing with CI filters for sometime and bumped to these questions/problems:

1- Isn't __color (defined both in JS editor and the kernel itself) a vec4? I'm asking this because I tested a simple dot function and the results were different. I attached the composition.

2- What is the best way to smooth the output especially in filters that are comparing a specific pixel with a bunch of others such as it's neighbors. I used pre-bluring the image and it worked (the output doesn't give the impression of being "noisy") but was wondering if something could be done inside the kernel. "smoothstep" maybe?

3- What are the first two arguments in the .apply command in the filter JS. I think the first one is the DOD (thanks to http://machinesdontcare.wordpress.com/2007/12/15/core-image-filters/ ) but the second one which is "null" usually I don't know. Is there a reference anywhere about the JS in CI.

4- Is there any resource for kernel examples. I would love to see apple's own CI filter's kernel (or any other "private" CI filter)?

I know, I know; Long and possibly silly questions :D

QC 4: Using ImageAccumulator in CIFilter

toneburst's picture

Just discovered the ImageAccumulator object in the JavaScript panel of the QC 4 Core Image Filter patch. Anyone know how I might correctly init the ImageAccumulator with the dimensions of the input image?

The code below inits the accumulator with a fixed size of 640x480px.

var dims = new Vec(0, 0, 640, 480);
var accum = new ImageAccumulator(dims, "RGBAf");
 
function __image main(__image image, __number feedbackAmt) {
 
   //var ext = image.extent;
   //var accum = new ImageAccumulator(ext, "RGBA16");
 
   var mixed = Filter.CIDissolveTransition(image, accum.image, feedbackAmt);
 
   accum.setImage(mixed);
 
   return accum.image;
}

It looks like it needs to be inited outside the main function loop to work, but I obviously can only get the dimensions of the input image from inside the main loop. I've tried making a function to init the accumulator object, but it doesn't seem to work.

Anyone any ideas? I've attached an example QTZ using the code above.

a|x