Sunday, November 17, 2013

Beginning my Apprenticeship in Machine Vision

Back in 1987 while an undergrad at CMU, I had an interest in machine vision. I read (and still have) David Marr's book "Vision". That was a period when neural networks were fashionable, and machine vision was a common research topic for neural network researchers. Fast-forward 26 years and I find myself the parent of a FIRST robotics participant (CMU-based Girls of Steel (GoS) Robotics). I wish to be in a position to assist the team with the robot vision aspect of the project, and was told to get acquainted with OpenCV .

"Adopted all around the world, OpenCV has more than 47 thousand people of user community and estimated number of downloads exceeding 7 million. Usage ranges from interactive art, to mines inspection, stitching maps on the web or through advanced robotics."

The GoS robot needs to perform a task which is assigned at the begging of the season. The last few year's tasks have had sports themes. Last year was Frisbee golf. I expect that this year will also be sports-based. Perhaps hockey? Anyway, the robot needs to know where it is on the field. There are placed on the field several vision targets in the form of circles or rectangles made out of reflective tape. By tracking and triangulating these targets, the robot should be able to determine its position and orientation on the field.

My vision (excuse the pun) is that a small, low-power single-board computer would act as the "vision brain" for the robot, and would send world position data to the main computer (a National Instruments CompactRIO). Actually the cRIO would "pull" the information from a web server running on the vision board. The market for small, low-cost computer boards has exploded in the last few years. The dominant board right now is the Raspberry Pi which costs only $35. I use one of those as my Home Theater PC (HTPC). The Pi is underpowerered for machine vision work, and the proprietary nature of the on-board GPU really cripples the device. After speaking with the lead technical mentor (a robotics scientist at CMU) I decided to purchase an ODROID-XU. This board is about five times more powerful than a Pi, and has a GPU which can easily handle machine vision. The board is only $169 and has an Exynos5 CPU and a PowerVR SGX544MP3 GPU. They also sell a USB-CAM for $15.

The PowerVM is a product of Imagination Technologies, and they have committed to providing OpenCL drivers so that OpenCV can take advantage of this board. Unfortunately they have not yet released the Linux drivers. They were supposed to be out by mid-November but I and a lot of other early-adopters are anxiously waiting. I just checked again and see there is no news. The fact that there is only one guy working on it and that he is also busy with other projects does not give me a great deal of confidence in having something in time for the next FIRST season.

Rather than idly wait, I decided to get started with OpenCV programming on my desktop computer. This computer has a 2nd generation Intel Core 5-series. It is not really strong in terms of GPU. I don't think Intel's flavor of OpenCL even supports it. My solution was to purchase a used Firepro V5900 on ebay. The new card bumped my Windows Index score on to 7.3 from 5.x. The card has good support for AMD's OpenCL drivers. AMD has a very well-written guide to setting up OpenCV which I have followed successfully. After compiling and running some of the OpenCV GPU samples, I now have some confidence in the tools and techniques.

The next steps in this project will take place on my PC. They include:

  • Doing an update to OpenCV 2.4.7
  • Learning how to do camera calibration
  • Exploring different options for object location
  • (re)Learning the matrix math to perform world to camera transformations

Obviously my PC isn't going on the robot, so a "small computer" solution is needed. I still think the most promising is that the ODROID gets OpenCL. Another inexpensive option is a Samsung Chromebook. They use a Mali GPU which, if my forum interpretations are correct, already has OpenCL drivers. Yet another option is the new Intel NUC which is Haswell-based and has what is perhaps the best OpenCL drivers – from Intel I believe.

Look here for regular updates on this project. Some posts may be by Heather to her own blog but I will reference those here also.

As an aside, this post was made from Word using the blog publishing feature. Since I had to do a lot of post-publish cleanup, I have my doubts about using that approach in the future. Markdown authoring integration is still my plan.

No comments:

Post a Comment