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

PreviewAttachmentSize
CIFilter Feedback.qtz7.98 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: QC 4: Using ImageAccumulator in CIFilter

i don't know if this does what you want but it doesn't break it.

var dims = new Vec(0, 0, 640, 480); var accum = new ImageAccumulator(dims, "RGBAf");

function __image main(__image image, __number feedbackAmt, __number w, __number h) {

dims = (0,0,w,h); var ext = image.extent;

//var accum = new ImageAccumulator(ext, "RGBA16");

var mixed = Filter.CIDissolveTransition(image, accum.image, feedbackAmt);

accum.setImage(mixed);

return accum.image; }

[edit] like i said that doesn't give error but im not sure how to know if it actually works. either way this feedback is super awesome look at how many fps im getting with it. see pic

PreviewAttachmentSize
Screen shot 2009-09-02 at 6.13.01 PM.png
Screen shot 2009-09-02 at 6.13.01 PM.png20.88 KB

vade's picture
Re: QC 4: Using ImageAccumulator in CIFilter

Ha, nice FPS. I've certainly noticed that the FPS object and counter in QC 4.0 reports some really wrong values occasionally.

cybero's picture
Re: QC 4: Using ImageAccumulator in CIFilter

Good code from dust, [again], and toneburst, I think you're owed an apology from myself, concerning a prior misunderstanding.

I had just begun to wonder again about Js in CI, what and where, until, finally, I searched and found below all that I had assumed to be mere guideline notes, the requiste and functional JS.

I couldn't help but laugh at my unintended dumbness :-)

Doh, Ha , ha, ha