Time Until Wedding
Days
Hours
Minutes
Seconds
 
Navigation
 
Search
 
My Usable Projects
 
Reading...
 
Listening...
 
Random Image
DSCF0009
 
Archives
 
Me. Elsewhere.
 
Feeds and Such

Google Reader or Homepage
Add to My Yahoo!
Add to Technorati Favorites!
Bookmark del.icio.us
Bookmark Furl
Bookmark Spurl
 
Darcy
 
Things I Like
EFF
 
License
 
Playing with OpenCV

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.

1
2
3
4
5
6
7
8
9
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.

1
2
3
4
5
6
7
8
9
10
11
12
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.

Posted February 26th, 2008 - Permalink
Categories: C++ - CameraBooth - Graphics - OpenCV - Programming - Projects
1 Comment »
 
Hall Of Shame

This is why Paul van Vliet is one of the best teachers I have had at UNO. He makes things fun, even the bad things.

From: Paul van Vliet
To: ...snip...
Subject: Hall Of Shame - Version 5.0
 
Good afternoon,
 
Please allow me to introduce you to the Hall of Shame.  It was shabbily
built, lacks glass in the windows, and the heating and plumbing systems
have failed to work for many, many decades now.  In fact, the Hall is in
such disrepair, the roof could cave in at any moment.  And yet some people
have decided to hang out here.  Why?  Well, I'm not sure, especially given
that the mere act of submitting a peer evaluation could get them out.
 
Please help me free these people - encourage them to do the right thing and
get their paperwork done!
 
Caught in the Hall today are:
 
...snip...
 
-PvV

I guess we’ll see how much I like him after the exam this evening…

Posted February 26th, 2008 - Permalink
Categories: School
No Comments »
 
VirtualBox Seamless Mode

I found VirtualBox “Seamless Mode” a while back and thought I’d post some screens. Actually comes in handy, no more desktop switching. Also just has a certain “wow” factor. Click through for the big versions.



Posted February 19th, 2008 - Permalink
Categories: Linux - Software
No Comments »
 
More Posts
Newer »