Tag: CameraBooth

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.

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.


for(int i = 0; i < frame->height; i++) {
  int offset = i*frame->width*3;
  for(int j = 0; j < frame->width; j++) {
    uchar temp = frame->imageData[offset+(j*3)]*0.114
                    + frame->imageData[offset+(j*3)+1]*0.587
                    + frame->imageData[offset+(j*3)+2]*0.299;
    frame->imageData[offset+(j*3)] = temp;
    frame->imageData[offset+(j*3)+1] = temp;
    frame->imageData[offset+(j*3)+2] = temp;

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

if(0 == memory_frameCounter)
  memory_frames[0] = cvCloneImage(frame);
else if(2 == memory_frameCounter)
  memory_frames[1] = cvCloneImage(frame);
else if(4 == memory_frameCounter)
  memory_frames[2] = cvCloneImage(frame);
else if(6 == memory_frameCounter)
  memory_frames[3] = cvCloneImage(frame);
else if(8 == memory_frameCounter)
  memory_frames[4] = cvCloneImage(frame);
else if(10 <= memory_frameCounter)
  memory_frameCounter = -1;


for(int i = 0; i < frame->height; i++) {
  for(int j =0; j < frame->width*3; j++) {
    memory_agg = frame->imageData[(i*frame->width*3)+j];
    for(int k = 0; k < 5; k++) {
      memory_agg = (memory_agg + memory_frames[k]->imageData[(i*frame->width*3)+j])/2;
    frame->imageData[(i*frame->width*3)+j] = memory_agg;

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.

int halfsies = frame->width/2;
for(int i = 0; i < frame->height; i++) {
  int offset = i*frame->width*3;
  for(int j = 0; j < halfsies; j++) {
    frame->imageData[offset+(frame->width*3-1)-2-(j*3)] = frame->imageData[offset+(j*3)];
    frame->imageData[offset+(frame->width*3-1)-1-(j*3)] = frame->imageData[offset+(j*3)+1];
    frame->imageData[offset+(frame->width*3-1)-(j*3)] = frame->imageData[offset+(j*3)+2];

Here is the reformed version, cleaner by far.

int halfFrame = frame->width/2;
int frameBytes = frame->width*3-1;
for(int i = 0; i < frame->height; i++) {
  int offset = i*frame->width*3;
  for(int j = 0; j < halfFrame; j++) {
    int jBytes = offset+frameBytes-(j*3);
    int ojBytes = offset+(j*3);
    frame->imageData[jBytes-2] = frame->imageData[ojBytes];
    frame->imageData[jBytes-1] = frame->imageData[ojBytes+1];
    frame->imageData[jBytes] = frame->imageData[ojBytes+2];

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.