Wednesday, November 26, 2008

AllSeeing: see it in action...

Here is the video of it in action.


two degrees of freedom... from gavilan on Vimeo.

AllSeeing: two degrees of freedom...

Two H Bridges built out of eight transistors and one week of research later and I have the following.



This rig, which is held together by hot glue, gives a Proof of Concept with two degrees of freedom. To further the proof of concept I needed a C application with simple user input. Because I have a little background in GLUT graphics I wrote up a simple window that processes the X, Y position of the mouse and converts it to polar coordinates. Attached is the source code. I will post a video shortly of the end result.

[file]

Saturday, November 22, 2008

AllSeeing: basic electronics, a refresher...

There are two types of motors that can be used for precision work, stepper motors and servo motors. They both have their benefits. Steppers are easy to interface with but do not tell you when they skip a step. Servos are basically DC motors with a feedback mechanism and a gear box. It is the feedback mechanism that is their strong suite, though they are more complicated to interface with. I will be using servos like this one.



In order to power these servos I will need some form of amplifier. Parallel ports only provide enough current for logic. To keep it simple and basic I will be using good old transistors like this one.



And, of course, I will need a way to put it all together.



Here is a picture of my workshop and my current research. :)


Tuesday, November 4, 2008

AllSeeing: an idea...

Knowing that in our senior year of college we would be required to complete extensive research on a topic of our choice was enough to inspire late night brain storming sessions among my colleagues in the Computer Science department. Most of these sessions resulted in us throwing outrageous ideas on the table and talking them to death.

Out of these sessions came the following idea. Would it not be cool to teach a computer to see? More specifically, get a web cam to follow people and look them in the face? This has been done before. There are commercial products that can keep a face centered. Still, it would be pretty cool to get a system like this up and running with nothing more than a web cam, some servo motors, and a parallel port.

It is my opinion that most AI of today is a bunch of smoke an mirrors. This is not bad. Smoke and mirrors can do some pretty impressive things. The reason this idea was never implemented by my colleagues is because from a Computer Science perspective it had already been done. If you have a subscription to the ACM Library you can read about detailed algorithms for Skin Detection, Face Detection, and Face Recognition. Surprisingly, Skin Detection can be implemented with only a few lines of C. Observe my go at this:


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <Magick++.h>
using namespace Magick;

int main(int argc, char **argv) {
    Image image;
    image.read(argv[1]);
   
    Color white = Color(MaxRGB, MaxRGB, MaxRGB, 0);
    Color black = Color(0, 0, 0, 0);
   
    int width = image.columns();
    int height = image.rows();
    printf("Width: %d Height: %d \n\n", width, height);

    int x = 0;
    int y = 0;
    for(x=0;x<width;x++){
        for(y=0;y<height;y++){
            ColorRGB pixel = image.pixelColor(x,y);
            double red = pixel.red();
            double green = pixel.green();
            double blue = pixel.blue();
           
            double a = (red+green+blue)/red;
            double b = (red+green+blue)/blue;
            if(a<2.5 && a>2 && b<4 && b>3){
                //image.pixelColor(x,y, white);
            }
            else{
                image.pixelColor(x,y,black);
            }
        }
    }
    image.write(argv[2]);
    return 0;
}


I executed this very crude and very fast solution on Angela Lansbury and Micheal Jordan, choosing these two people partially by random and also in order to show the versatility of the solution. Below is the result.






As you can see, the result looks very promising. So... skin detection is a check. All that would be left as far as algorithms would be the face detector, which I feel would also be trivial. This is where Computer Science ends and Electrical Engineering begins. In order to have a complete system the web cam would have to be mounted on a platform that would allow it to follow a face. This platform would have to be controlled from the same executing C code that is analyzing the web cam feed. Sounds like I need to dig into my basic electronics books, something I haven't done since junior year of high school.