ImageAccumulator

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