method chaining for ofxCvImage

I noticed that all the methods in ofxCvImage return void. If they were changed to return a reference to ofxCvImage (i.e., every function ends with return *this;), you could support the popular method-chaining idiom that is popping up in APIs all over the place.

I think the idiom is particularly well-suited to image processing code, which usually sets up some kind of pipeline or other, either implicitly or explicitly.

So instead of code that looks like this:

//assume img is some ofxCvImage-derived type:

img.blur();
img.rotate(10, cx, cy);
img.erode();
img.warpPerspective(p1,p2,p3,p4);

your code could look like this:

img.blur().rotate(10, cx, cy).erode().warpPerspective(p1, p2, p3, p4);

which is succint, makes the pipeline aspect explicit, and is intuitive and aesthetically pleasing.

It would be a simple code change, and moreover, it wouldn’t break any existing code, since nobody was using any return values from the calls anyway.

Just a thought,

Kevin