Pets, Plants, and Computer Vision

Classifying Images

March 25th, 2011 | Posted by admin in C++ | classification | code | Columbia | computer vision | machine learning | OpenCV | segmentation - (Comments Off on Classifying Images)

Beach classifier, I wish I was here.

I have been burning the midnight oil finishing up a project for my Computational Photography course at Columbia University. For this project we had to make two classification systems, one which classified beach and grassland imagery using a given feature vector description, and a second classifier for any two objects using whatever technique we wished to generate the feature vectors. It was suggested that we do our work in Matlab, but we had the option to work in C++. I opted for the latter as I really wanted to write something that I could possible re-use in another project. The final system was developed under Windows using Visual Studio 9, and makes liberal use of OpenCV 2.2 and LibSVM 3.0.


The beach / grassland images were classified by dividing the image into a three by three grid and calculating the color average, color standard deviation, and color skew for each of the HSV channels. This feature vector was then used in a support vector machine with a linear kernel. The overall error rate was 13.33%. For the beach images 11.67% were misclassified as grassland, while 15.00% of the grass images were classified as beach. The classification is written in the top, left corner. If the image was misclassified there are two values listed. The red value is the classification, and the green value is true value.

Correctly Classified Grassland

For the second part of the project I wrote a system that classifies images as either screws or nails. The system assumes that both of these objects are aligned to be roughly vertical. I wrote a separate class awhile back that would re-orientate the images based on the major axis of the extracted contour. To do the classification I first thresholded the gray scale image and then extracted the resulting contour. After doing this a few morphological operations were performed on the contour and the Hu-moments and a few other statistics were calculated. I also applied the Canny edge detector to the images and piped the results into a Hough line detector. The results of the line detector were then binned according to length and orientation. This data was used to generate a feature vector which was used for classification via a support vector machine with a linear kernel. The overall error rate was 3.58%. 1.33% of the screw images were misclassified as nails, while 7.27% of the nail images were misclassified as screws. The classification is written in the top, left corner. I used the letter “N” to indicate nails, and the letter “S” to indicate If the image was misclassified there are two values listed. Some results are shown below.

Samples from the screw / nail classifier

The complete set of beaches and grassland images can be found in my beach / grassland classification set on flickr along with the complete set of screw/nail classification results. The code is posted on my computational photography Google code page. The code was written under the gun so it isn’t nearly as clean as I would like it to be, and everything is very data set specific. Hopefully once the semester is over I can go back and refactor it to be a more general solution.

Big Announcement

March 21st, 2011 | Posted by admin in Ann Arbor | automation | Automation Alley | computer vision | entrepreneurship | industrial computing | Ingenuitas | manufacturing | Michigan | Open Source - (Comments Off on Big Announcement)

I am on my way back to New York from Michigan and it is time to make it official. I have accepted the position of Director of Research and Development at Ingenuitas in Ann Arbor, Michigan. Ingenuitas will be working though the summer to develop an open source hardware/software product for manufacturing inspection systems. We plan on having a demonstration of our early results in September. I will focus specifically on developing an easy to use computer vision system that brings a number of emerging computer vision techniques to the machine inspection domain. I will also seeking potential investors from the New York technology community. We hope to demonstrate that open source has the potential to dramatically reduce manufacturing costs and empower smaller companies to use techniques and quality control measures that were until recently only available to larger manufacturers. The Ingenuitas team also includes my friends Anothny Oliver and Nate Oostendorp. I am really excited for this team as I think we have the perfect mix of skills and experience to get this venture off the ground. Furthermore I am ecstatic to be working on an open source project that has the potential to dramatically change both computer vision and manufacturing for the better. I will post more thoughts about this project when I get a chance.

RPS simulator

March 5th, 2011 | Posted by admin in artificial intelligence | code | Columbia | demo | In the news | machine learning - (Comments Off on RPS simulator)

I came across this cool interactive feature in the New York Times: RPS Simulator. Basically you play rock, paper, scissors against an algorithm that has learned how to play an optimal game based on prior data. The trick is that humans try to think about the game, versus playing truly randomly. If you play a truly random game you should be able to at least tie the computer. To generate random numbers I moved my mouse around with my eyes closed and guessed my move based on the mouse location. Alternatively you could use the seconds hand on a clock and modulo the number by three.

For my machine learning class this week we have to write this algorithm given a training data set. I will post the code after the homework submission deadline.

Tim and Greg at Backyard Brains are the Coolest People (ever!)

March 5th, 2011 | Posted by admin in Uncategorized - (Comments Off on Tim and Greg at Backyard Brains are the Coolest People (ever!))

My friends Tim and Greg’s startup Backyard Brains just got featured on Boing Boing. I am so happy for them. I am also totally psyched that some of my past research (a) is getting commercialized and (b) is getting commercialized for good not evil. Tim sent me a text message or the early results a couple of days ago. They still have a ways to go, but I so pleased about the results. Tim and Greg really are the guys I wanted to be as a kid, and they are doing some really important work that deserves much more attention.

Cyborg Cockroaches

Early Robo Roach Prototypes sponsored by DARPA

I just happened to have a few of the old specimens from when I made robo roaches for a DARPA project in undergrad (c. 2001). I took a few photos to show you how far the technology has progressed since I worked on it in 2000. Back then we had a simple “backpack” made from a phone jack and a length of microwire. This setup looks positively arcane when compared to Tim’s self-contained remote control. It is worth noting that the cockroaches in my picture are Gromphadorhina portentosa which are slightly larger than the species they are using at Backyard Brains.