An earlier blog post discussed a simple approach to object recognition and included a complete project in C#. I ported the code to Objective-C and made a video of the use of the code for object recognition for a small robot that I am building. This short post mostly adds a few points to the video. The earlier post referred to previously is where most of the code is. The robot uses an iPod running EyesBot Driver, which will be submitted to the Apple App Store soon, hopefully next week.
There were two primary problems to solve: how to teach the robot what an object is called, and how to later recognize the object.
The sequence of events that occurs when the robot learns an object is: This turned out to be quite simple to implement, and permits easy communication between the robot and user (see the video to see the learning in action). The code for this choreography is:
The recognition is simple determining whether the palette present in the object corresponds to any of the learned objects. Please see the project in the other blog entry for a complete project that implements this approach, but the code to test the extracted color palette against the learned color palettes is:
The main problem is that this only looks for a palette, whereas objects also have a visual texture and morphology, and the colors for an object should be present in an image in a way that is consistent with the expected visual texture and object morphology. This simple approach is useful for a quick screen to narrow down the possible objects for further screening, but also have the problem of light level changes affecting the apparent color palette.
I'm looking forward to releasing EyesBot Driver in the next few weeks, but it will likely not contain this functionality until the functionality is much more mature. It is quite useful for navigation (since rooms tend to have distinctive color palettes) and also as presumptive object recognition. Lots of work left to do, though.
Effecting the physical world