Tag: OpenCV

More libcvfx: New effects and runs in Windows

March 29, 2008 » Geek

I got libcvfx compiled on Windows with Dev-C++. I don’t have it as a library or anything, just got the demo working for now, proof of concept if you will. It was a bit slower on Windows, and I didn’t get the 640×480 out of my web cam. Additionally the highgui didn’t register the arrow keys right so I had to change those.

What I was really wanting to see was if it would run in Windows at all. This would possibly open up a bigger range of web cams for the CameraBooth project, perhaps some of the higher end, higher resolution ones.

Anyway, here’s a screen of it running on Windows and one on Linux for good measure. Click through for the big images.

Windows

Linux

Additionally I’ve added a few new effects since the last post. Some don’t capture well, so I’ll just describe those ones.

Photo Copy
This one takes a threshold and any pixel under the threshold is turned black, any pixel over it is turned a user specified color, default is white. This tends to be harsh, it might be good to run a blur on it or maybe set a few midpoint values between black and the color to fuzz it a bit.

HStripFlip
Cuts the image into as many strips as you want, then flips every other strip. Defaults to 4 strips.

Corners
This isn’t a new effect, but now you can choose which corners to exchange.

There are a number of effects I didn’t take pictures for.

VStripFlip is like HStripFlip except vertical.
Broken Television is a motion effect where the image scrolls like an out of sync TV. Hard to describe really.
Noise just injects pseudo-random pixels into the image, but it does a poor job of it right now.
Interlace Lines replaces every other horizontal line with all black.

I’ll have more about these effects as well as pictures and maybe video once I get a project page set up for libcvfx. For now you can hit up the repo for source, or grab the Window binary here. You will need the OpenCV libraries installed, and in your PATH.

libcvfx

March 10, 2008 » Geek

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.

Screwy OpenCV Manipulations

March 2, 2008 » Geek

I’ve been playing more with OpenCV and I think I’m missing something. I can’t do any manipulations on the image data without really screwing it up. The only thing that doesn’t seem to wash out the data out is moving pixels around without changing them. Not sure what I’m missing. Here’s the few different manipulations and what they look like when they wash out.

Monochrome


Memory
This one just keeps five frames and then adds them in to create a faded composite, should be simple.

I just can’t figure out what I’m doing wrong here.

Playing with OpenCV

February 26, 2008 » Geek

OpenCV is a cross platform video library I’ve been playing with. Today I coded up a horizontal mirror effect, took about 30 minutes. I worked out all the byte manipulations on a piece of paper, that took the longest. Coding was a breeze with OpenCV, and I tried out some of the built in effects too, stacking them on top of each other.

Here’s my first version source for the mirror effect, it’s rough since I just translated what I had written down into code. “frame” is a captured IplImage.

Here is the reformed version, cleaner by far.

And here is what it looks like. The first one is without any other effects, the second is with the OpenCV effect “erode”.


You can get the full source of my fxTest.cpp here if you want it.

The Introduction to programming with OpenCV was a great resource for me.