libcvfx

March 10, 2008

I’ve been playing with OpenCV recently and was having troubles with creating effects. That’s all over now thanks to the OpenCV mailing list, you can see the fix in the comments of this post. Since I can now manipulate colors and pixels with ease I’ve been writing a few more neat effects. And yes, I know that this is not what OpenCV is for, but it’s a really handy library and I like it.

I decided to pull them out of my test program and make them into a little library. Having never made a library before I[m sure I did some things wrong, but it works and that’s what I care about right now.

I doubt my manipulation method is the fastest, but I’ve tried to be economical and share resources between effects. I also included a test program so you can try out the filters. These are all written by me so far, with inspiration but no code from other sources. I’m hoping to port over some of effectv’s super cool filters as time goes on. You can click through on any of the pictures below for a 640×480 version.

Baseline
This is my normal image I get from my cheap labtec webcam.
And yes, I am that good looking.

Green
Probably the simplest effect, it just involves turning off the blue and red channels.

Mirror
Copies and flips the left side onto the right.

Monochrome
Simple like green, just sums the three channels into one value.

Corners
This one swaps the top left and bottom right corners. I’m going to swap top right and bottom left later.

Horizontal Flip

Vertical Flip

Memory
This is one of the harder ones. It stores three frames in memory and then combines them with the current frame for a ghosting type of effect.

Oompa Loompa
For lack of a better name.

Invert

Pixelize
This is the only one with parameters, and one of my favorites.
The parameter is the “pixel size”.
From top down it is set at 2, 6 and 10.


You can grab the 0.01 source here (doesn’t have the invert filter) or browse the svn repo at http://svn.velvetcache.org/libcvfx/ for more current stuff.

Leave A Comment

Your email will not be published.