circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

May 2006, Issue 190

Image Processing for Robots
Renesas M16C Platform Design Contest 2005


SEARCH & TRACK OBJECTS

Image processing isn’t a feature normally associated with inexpensive low-power robotics platforms. I designed the UniRoP because I wanted to learn more about simple picture processing. Some of the M30624’s features led me to expect that my experiments would be successful. The M30624 has approximately 31 KB of RAM, and it can be programmed in direct memory access (DMA) mode. The videoa1.c software module on the Circuit Cellar FTP site includes all the necessary functions for simple object detection.

To test image quality, simple test software can read an image via an RS-232 cable to the PC. The serialcam.exe PC tool and a picture of the test scenery are posted on the Circuit Cellar FTP site. To minimize RAM usage and computational power, the image’s size is limited to approximately 64 × 120 black and white pixels. The system’s picture quality is poor because of the low resolution. The image-processing software’s task is to detect and display the largest object.

The main problem for the search algorithm is the distinction between the object and the background. In my first experiment, object and background pictures were separated by the intensities of their images. The picture is described by a matrix of the image pixel IM,N. You now need an intensity level (S) operator to separate the image areas belonging to the object (O) from background (B). The probability (P) of the intensity is:

           

IO is the number of object pixels. IB is the number of background pixels.

The intensity distribution is:


The overall error (E) is easy to calculate:

 

An optimized level operator is defined as:

This equation separates the object from the background. If the object looks like a Lamberthian radiator (an object with equal light intensity), s2 is less than (µO – µB). Thus, you can ignore the second part of the equation.

Listing 2 gives you an idea of how to calculate the value of the level operator S. With the bLevel value, the object and background are differentiated. All values larger than bLevel can be part of the object. Smaller values are part of the background. 

The equations look impressive, but how does the algorithm work? Photo 2 shows some results. Photo 2a is the x-coordinate with a fixed intensity level in the search algorithm. Parts of the background are marked as a part of the object. The result isn’t useful.

a)
b)

c)

(Click here to enlarge)

Photo 2—I sampled various methods to improve the photo quality. The shots are grainy at this size, but you get the idea. a—Here you see the image without a color filter. b—I used a red filter for this image. c—This time the object is a Lambertian radiator.

A red color filter was put on the lens for Photo 2b. Unfortunately, some pixels weren’t detected. It’s better, but not good.

In Photo 2c, however, the x-coordinate is set to the correct value. The searching algorithm doesn’t use a fixed level for separating the object and the background. The value has to be adapted by dependencies of actual light conditions (the red filter also helps).

Assuming the object emits Lambertian light rays, the luminance density is the same on every point of the object surface, the algorithm separates the object much better from the background. A low-power red LED illuminates the ball to give a Lambertian radiator. You may download a short video clip illustrating the results and showing the UniRoP in action (as well as a couple of other robots) from the Circuit Cellar FTP site.