FAQ

Version 21 (Kwabena Agyeman, 02/13/2012 12:38 am)

1 1 Kwabena Agyeman
h1. Frequently Asked Questions
2 1 Kwabena Agyeman
3 1 Kwabena Agyeman
h2. *General Questions*
4 1 Kwabena Agyeman
5 1 Kwabena Agyeman
h3. *What is unique about CMUcam1?*
6 1 Kwabena Agyeman
7 2 Kwabena Agyeman
Traditionally fast computers are needed to capture and process camera images. It is also necessary to write the software to perform this processing. Because of this it is difficult to use vision as a sensor in simple systems.  
8 1 Kwabena Agyeman
9 2 Kwabena Agyeman
The CMUcam1 vision system uses a fast low cost microcontroller to handle all of the high speed processing of the camera data and contains software to perform simple vision tasks. Because the user can choose to output only low bandwidth high level information from the vision system, like the red object is at position X-Y, it is possible for a simple processor like a PIC Microcontroller to read this data and direct a small robot in tasks like chasing a colored ball. The CMUcam1 vision system makes it possible to ignore the complexity of camera interfacing and use vision just like any other sensor (i.e. sonar) often used in robotic systems.  
10 1 Kwabena Agyeman
11 2 Kwabena Agyeman
h3. *What is CMUcam1's frame rate?*
12 2 Kwabena Agyeman
13 2 Kwabena Agyeman
The fastest frame rate is 16.7 frames per second.  This means CMUcam1 can tell you the position of an object about 17 times per second. Using the serial software protocol you can slow this down if desired.
14 2 Kwabena Agyeman
15 2 Kwabena Agyeman
h3. *What baud rates does the CMUcam1 support?*
16 2 Kwabena Agyeman
17 2 Kwabena Agyeman
As of the latest version of the firmware (v1.12) the CMUcam1 can communicate at baud rates of 9600, 19200, 38400 or 115200. The baud rate is selected via jumper settings on the board.
18 2 Kwabena Agyeman
19 2 Kwabena Agyeman
h3. *How do I upgrade my CMUcam1 firmware?*
20 2 Kwabena Agyeman
21 15 Kwabena Agyeman
If you are currently using firmware v1.11 there is no reason to upgrade unless you need support for the lower baud rates. Version 1.11 supports 38400 and 115200 baud. Version 1.12 supports those baud rates and adds support for 9600 and 19200 baud. To upgrade your firmware you will need to reprogram the flash memory in your processor chip. The easiest way to upgrade is to purchase a new processor with the new code flashed into it. If you have a programmer you can download the current version from our [[downloads]] page and re-flash the processor yourself.
22 1 Kwabena Agyeman
23 3 Kwabena Agyeman
h3. *Does CMUcam1 work outside?*
24 3 Kwabena Agyeman
25 3 Kwabena Agyeman
The CMUcam1 works outside but not in direct sunshine. The CMOS camera we are using does not have a high-quality IR filter, and so sunlight saturates the red pixels and the image becomes, essentially, monochrome in direct sunlight. (It is possible to add an external filter to improve outdoor operation). We have a short write up in [[publications]] that shows you how illumination conditions affect CMUcam1.
26 3 Kwabena Agyeman
27 3 Kwabena Agyeman
h3. *Can I write custom code for CMUcam1?*
28 3 Kwabena Agyeman
29 3 Kwabena Agyeman
Certainly. To do this, ask us for the firmware source code, order yourself a C programming environment for the "Ubicom":http://www.ubicom.com chip and go for it.  When we send you the firmware source code we will also send you a summary of how the code is structured and information about the programming environment we use.
30 3 Kwabena Agyeman
31 4 Kwabena Agyeman
h3. *How much power does CMUcam1 consume?*
32 4 Kwabena Agyeman
33 16 Kwabena Agyeman
The complete system consumes about 200 milliamperes.
34 4 Kwabena Agyeman
35 4 Kwabena Agyeman
h3. *What is the camera's field of view?*
36 4 Kwabena Agyeman
37 4 Kwabena Agyeman
This depends on the lens that you fit to the CMOS camera. If you order the CMOS camera as it is sold standard, you will end up with about a 25 degree field of view, which is relatively narrow. You can custom-order wider angle lenses when you order your CMOS camera, however.
38 4 Kwabena Agyeman
39 4 Kwabena Agyeman
h3. *What processor does CMUcam1 use?*
40 4 Kwabena Agyeman
41 17 Kwabena Agyeman
Our image processing code resides on a microcontroller chip from "Ubicom":http://www.ubicom.com running at 75 MHz, the "SX28AC":http://cmucam.org/attachments/download/290/SX-DDS-SX2028AC-16.pdf. This chip reads all the pixels from the CMOS camera via a parallel interface and does all the processing in real time. It then communicates the results to your microcontroller or computer via a serial port interface.
42 4 Kwabena Agyeman
43 4 Kwabena Agyeman
h3. *What CMOS camera does CMUcam1 use?* 
44 4 Kwabena Agyeman
45 20 Kwabena Agyeman
We use a CMOS camera which utilizes the "OmniVision":http://www.ovt.com "OV6620":http://cmucam.org/attachments/download/281/ov6620DSLF.pdf CMOS Camera on a Chip. We use a model number C3088 CMOS Camera Board on which is mounted the sensor, a connector and a lens.
46 4 Kwabena Agyeman
47 4 Kwabena Agyeman
h3. *Does CMUcam1 work with other CMOS cameras?*
48 4 Kwabena Agyeman
49 19 Kwabena Agyeman
No. Currently the hardware and software system have been designed to work specifically with the "OmniVision":http://www.ovt.com "OV6620":http://cmucam.org/attachments/download/281/ov6620DSLF.pdf CMOS Camera. The system would need to be completely redesigned to work with another camera.
50 4 Kwabena Agyeman
51 21 Kwabena Agyeman
h3. *Is there some place I can find answers to additional questions I have?*
52 21 Kwabena Agyeman
53 21 Kwabena Agyeman
Yes. We have some info about more technical questions on this page.
54 21 Kwabena Agyeman
55 4 Kwabena Agyeman
h3. *Where can I find out more about computer vision in general?*
56 4 Kwabena Agyeman
57 4 Kwabena Agyeman
The CMUcam1 performs the simple computer vision task it was designed to perform in a small, inexpensive package. However, the general computer vision problem of trying to recognize arbitrary objects under arbitrary conditions is still a very active research topic and very far from being anywhere near a solved problem.
58 4 Kwabena Agyeman
59 4 Kwabena Agyeman
If you want to learn more about computer vision, you might want to try these links: 
60 4 Kwabena Agyeman
* "The On-Line Compendium of Computer Vision":http://www.dai.ed.ac.uk/CVonline/ 
61 4 Kwabena Agyeman
* "The Computer Vision Home Page at CMU":http://www.cs.cmu.edu/~cil/vision.html
62 1 Kwabena Agyeman
63 1 Kwabena Agyeman
h2. *Technical Questions*
64 6 Kwabena Agyeman
65 6 Kwabena Agyeman
h3. *What is the exact sequence of steps performed on power up by demo mode?*
66 6 Kwabena Agyeman
67 7 Kwabena Agyeman
Here is the exact sequence that demo mode performs on power up:
68 7 Kwabena Agyeman
69 7 Kwabena Agyeman
#  Reset the camera. 
70 7 Kwabena Agyeman
#  Wait 5 seconds for the camera parameters auto adjustment to stabilize.
71 7 Kwabena Agyeman
#  Send the camera register string: "CR 18 32 19 32" which selects YCrCb mode and turns off auto gain. 
72 7 Kwabena Agyeman
#  Execute the "TW" command.
73 8 Kwabena Agyeman
74 6 Kwabena Agyeman
h3. *What is the exact sequence of steps performed by the "TW" command?*
75 8 Kwabena Agyeman
76 8 Kwabena Agyeman
Here is the exact sequence that the "TW" command performs: 
77 8 Kwabena Agyeman
78 8 Kwabena Agyeman
#  Shrink the window to 1/4 the size (in each dimension) of the current window to a new window centered at the current window center.
79 8 Kwabena Agyeman
#  Call get mean.
80 8 Kwabena Agyeman
#  Restore the window to the full image size. 
81 9 Kwabena Agyeman
#  Set the min and max value for each color channel to be the mean for that channel -/+ 30.
82 1 Kwabena Agyeman
83 11 Kwabena Agyeman
h3. *Under what conditions does the tracking LED light up when auto mode is enabled?* 
84 1 Kwabena Agyeman
85 11 Kwabena Agyeman
The LED will light when the returned pixel count >= 2. The returned pixel count = (actual_pixel_count + 4) / 8.
86 11 Kwabena Agyeman
87 12 Kwabena Agyeman
h3. *If the CMOS camera has a resolution of 352 x 288 pixels, why is the CMUcam1 resolution only 80 x 143?*
88 1 Kwabena Agyeman
89 13 Kwabena Agyeman
The issue here is how color digital cameras work. In all digital color cameras (even the very expensive ones - except for some based on some "very new technology":http://www.foveon.com) you only get one color channel measurement per pixel location, this is called mosaic filtering. Here is a nice diagram which helps explain this:
90 13 Kwabena Agyeman
91 14 Kwabena Agyeman
!http://www.cmucam.org/attachments/305/mosaic.png!
92 14 Kwabena Agyeman
93 13 Kwabena Agyeman
(Diagram courtesy of "Foveon, Inc.":http://www.foveon.com) 
94 13 Kwabena Agyeman
95 13 Kwabena Agyeman
So what you can see is that pixels can be thought of being arranged in groups of fours, where there are two G measurements and one R and one B measurement per group. If you discard one of the G measurements (which we do) you see that the real resolution of a 352x288 camera is closer to 176x144. We run the camera in half resolution mode which skips over every other 2x2 block horizontally which gives you 88x144. Because of memory limitations in the processor we discard 8 columns horizontally and one row vertically that contains a test pattern which gives you 80x143 as the final resolution. 
96 13 Kwabena Agyeman
97 13 Kwabena Agyeman
Just FYI standard digital cameras use complex interpolation techniques to try to fill in the missing color values at each pixel and give you something a little closer to the full resolution of the sensor. 
98 12 Kwabena Agyeman
99 12 Kwabena Agyeman
100 1 Kwabena Agyeman
h3. *How can I focus the CMUcam1 accurately?*
101 11 Kwabena Agyeman
102 11 Kwabena Agyeman
Of course, the best way to proceed with focusing is to take dump frames using the GUI. You may not have a computer handy, or you may be using a BotBall CMUcam1, which doesn't have sufficient resolution at its hard-wired 9600 baud for this to work well.
103 11 Kwabena Agyeman
 
104 1 Kwabena Agyeman
In that case, there are two alternatives. First, you can try counting threads. The lens is not screwed fully in at peak focus. Rather, there is about a 1 millimeter gap of thread showing. In terms of number of threads, that is about 2 threads showing in the gap between the lens and the lens mount. 
105 11 Kwabena Agyeman
106 12 Kwabena Agyeman
The second alternative relies on the idea that when an image is sharp, the darks are darkest and the brights are brightest. In other words, the contrast is greatest. When the image becomes defocussed, then the extrema fade away to a more uniform distribution of intensities. So, if you fire up streaming mode using Teraterm or Hyperterm, and then call GM (Get Mean), you can focus in real time. Look at the Red deviation. As you focus sharply on a high-contrast object (such as a piece of paper with lots of writing on it) at the desired distance, there will be a noticeable peak in Red deviation when most sharply focused. Note that this approach to focusing requires you to have the camera and the target quite firmly planted as you turn the lens.