Tag: C

CameraBooth Monitor

July 14, 2008 » Geek

I’ve been working on CameraBooth some more and I separated out a launcher/monitor window for the application. You can load configurations then run them without having to use the command line. In that same vein you “should” be able to use it on multiple monitors now, so you can have your launcher on one screen and the booth window on another. I haven’t been able to test that for lack of having multiple monitors.

This is just a “preview” of what’s to come, right now it is super unstable. I don’t thread correctly, I just kind of hijack the glib main loop, so it’s a bit prone to crashes. I’ll fix that soon though. Until then here are some preview images of the new monitor screen.

Showing a failed booth window launch (didn’t plug in camera)

Showing the “live” monitor view. You can see what’s going on in the booth as well as monitor events like image captures.

libvcvideo Working

June 18, 2008 » Geek

I started yet another project a few weeks ago. This one, called libvcvideo, is intended to be a super simple way to access video devices, especially web cams. I’ve been writing it to replace the more feature rich, but heavier OpenCV in my other projects. Yesterday in class I got the first working product, so I made a flurry of refinements, added some documentation, and I’m now showing it off.

It’s nothing amazing yet, it only works in Linux on V4L devices that are web cams and use the RGB24 data format. That said, it’s still a lot of devices, especially from the spca5xx and gspca drivers.

I’ll be adding more to it over time, but here is some proof of concept items.

Here is a fullscreen shot of the library running my gtkmm test program. The library was compiled with it’s debug option which provides all that information in the terminal window.

One cool thing I added is a sigc++2 signal for measuring the progress of operations. Here I have it hooked up to my gtkmm test program showing where it is in the initialization process.

Here is the first image I captured with the library. If it looks a little off color, it is because I hadn’t corrected the byte ordering on the format yet, so blue and red are swapped. Yes, it is a boring first image, but the camera was under my desk and I didn’t want to offend the teacher by openly working on this during a macroeconomics lecture.

Here is about the most simple example possible. It safely creates, opens, initializes, and grabs a frame from the device “/dev/video0”.

using std::cerr;
using std::endl;
using std::string;

#include "lib/videoDevice.h"

int main (int argc, char ** argv) {
  vc::videoDevice device ("/dev/video0");
  vc::vdFrame frame;

  try {
  catch(string s) {
    cerr << "Device initialization failed: " << s << endl;

  try {
  catch(string s) {
    cout << "Failed to get frame: " << s << endl;

You can get more details on the project page.

The Mana World Buddy

April 7, 2008 » Geek

Wrote a little buddy list application to The Mana World RPG. Nothing fancy, rx but I got to try out libcurl.
Go To Project Page

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.



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.

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

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.


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.

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

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

Copies and flips the left side onto the right.

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

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

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.


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.