Software > Software

Linking up a camera

(1/3) > >>

Hi there,

For a university project I am doing this year, I will be creating a robot that uses a camera to navigate itself around an environment. However, I have little past experience on such a matter and would really appreciate some advice on how this can be achieved.

Mechanically and electrically, my robot is already fully functional, but it lacks its brain, and the camera interface. It will not be required to perform high level computer vision techniques, but will need to sense brightness thresholds - will a microcontroller be powerful enough to do this, or would I need to linke up the robot to a PC? Any suggestions for suitable microcontrollers?

As far as the programming is concerned, I have been warned that Java is too slow for the necessary real-time analysis that will need to be performed, so I would like to use C if possible. Any ideas on how I can capture frames, access pixel data and analyse it, and then send appropriate instructions to the robot's microcontroller, using C?

I'm pretty much a beginner in robotics so any help at all would be much appreciated! Thanks.

What sampling rate do you need?

Java is fine for computer vision - I have used it for an old webcam on a robot. Unfortunately, I do not have any of my sample code to give you since I did it for a class assignment a few years back and lost it. Search the web for webcam processing (not sure what the best word to use for this is) source code . . .

You probably dont want to use a microcontroller, unless you have a camera/circuitry that does all the processing externally - such as the CMUcam. Image processing is very intensive.

What kind of vision quality do you need? There are many lower level sensors (like photoresistors) that can also do brightness thresholding . . . If you dont need good quality, lower resolution cameras will give you higher sampling rates.

Thanks for the help. My robot is basically required to detect beacons of light and hence determine its position and navigate around. Photoresistors would not give me a high enough resolution I'm afraid. It won't be moving particularly quickly, so I reckon a sampling rate of at least 10 Hz should be ok.

I have had a look at the CMUcam, but it is not within my budget. From what I gather, it just uses another microcontroller to extract the data from the camera, which can then be sent to the robot's controller. I think this involves reading in a string of serial data containing pixel voltage levels, into an ADC, and then storing it as an array of data to build up each frame. Would it not be possible to buy a microcontroller and program it to do this myself?

Another student doing a similar project used Quicktime for Java to analyse video, but this required almost one second to analyse each frame. Is there a quicker way this can be done in C? Thanks!

are you sure 2 or more photoresistors wont work?

A CCD camera is basically a matrix of photoresistors . . . with one you can determine the light brightness, with 2 photoresistors you can locate the light, with three you can determine the distance away by triangulation. Most microcontrollers have 8 ADC ports, so you can make a 4x2 matrix of photoresistors . . . Considering your budget, thats damn cheap  :P

the time it takes to analyze a frame depends entirely on the resolution, the information you need extracted, and the accuracy desired. for extremely fast processing, convert all the images to greyscale (black and white), reduce the resolution (delete every other line, etc.), trim edges, etc - basically delete any info not required.

if all you are doing is locating the brightest light, what you do is save the image into a matrix, scan the matrix for the brightest pixel, then record the x and y location in the matrix of that brightest pixel. there are more reliable ways to do this, but this is the simplest fastest method.

interfacing a camera directly to a microcontroller is possible but not easy.
i did a lot of reading on the subject and even went as far as looking at video signals on an oscilloscope.
from what i have seen on line there are 2 methods people have had success with.

1. some cameras have a digital output. although the cameras tend to be more expensive there is *far* less work to do.
take note that microcontrollers only have a limited amount of memory so you probably won't be able to capture every pixel.
the CMU cam uses this method.
here's a link to this sort of solution:

2. most cheap cameras give the out put as composite video. there are links out there to people who have successfully interfaced microcontrollers to this sort of camera but this solution is not for the faint hearted.
here's an example:

although it's possible both these methods are a big undertaking.
i'd suggest you get one of these wirless video cameras and send the output back to a PC TV card and do your processing on a seperate computer.
alternatively, if wirless is not a requirement, use a $10 USB webcam from ebay.

most modern programming languages have modules to decode mpeg images.
i have successfully used python as a programming language for video decoding (with similar speed restrictions to your friend using Java) but it should be considerably quicker using C.

good luck!



[0] Message Index

[#] Next page

Go to full version