Cam Color Caliberation

I am having trouble caleberating the camera. The vision is working perfectly fine, but it doesnt detect colors. If I try to search for a color it says ERROR. please try to get back to me if u can?
THANK YOU

Have you tried the troubleshooting methods in the calibration PDF that came with the camera? It tells you how to remedy the various error messages.

We are also having trouble calibrating the camera. What type of lighting does everyone use? We tried regular fluorescent lighting and then we tried the halogen lighting. But none were successful in calibrating all three colors. We kept getting the error “Color not found, or too much light” or “color not found, or not enough light”. How many teams actually got their camera calibrated already?

It would have been really nice if there was some technical support for this camera. I also find it funny that in Update #5 FIRST says to contact innovation first for CMUcam2 assistance. However, on the innovation first website, it says that they do not offer any camera support. LOL (wait, why am I laughing? :confused: )

:stuck_out_tongue:

i’m also having trouble with my camera… sorry i’m just adding problem upon problem instead of trying to help other teams with their problems but here’s my share:
my camera read s the color jut fine and everything and i’ve gotten as far as the camera giving me values from the target. however, it gave me the same value for green as it did for yellow. being smarter than that… i know something’s wrong. also i don’t know specifically which numbers i should be looking at because there are some for red yellow and green or blue whatever. but the thing is that i don’t know if for one target i should be getting three diff values adn put all those in (say green, then i would get a large number for blue and yellow and a smaller number for red… seeing as green IS a mixture of the primary colors, etc. etc.) even though this may seem like a smart set of numbers to use for the programming, the program isn’t giving me any of the values for any of the other colors, just the value of the color of the target. so my question to you guys is what set of numbers should i use and what would be causing the program to give me the same value for two different colors?
sorry to butt in to someone’s else’s thread, but i didn’t want to start a completely new thread with a problem that’s very closely related to this one.
thanks, isabel
ps: it doesn’t say on my profile but my screen name for aim is binxybel so if there’s any way that you can reach me through there, since i feel it’s the most direct way of communication, that would be great! thanks!

The three numbers I think you’re talking about are the RGB numbers. One is for Red, green and blue. These three values make up the color of your target. I believe however that this is not the color that you want for the AEC (automatic exposure control) calibration. The steps that we took for the calibration are…

  1. set up the red, green, or yellow target
  2. grab a frame
  3. click on the target to highlight to make sure that most of it is recognized (highlighted)
  4. click on the Red, Yellow, or Green button at the top part of the screen to calibrate it for that target color. If it works sucessfully the program should give you a number in the box rather than the ???. So you will actually only get one number per target calibration.

After calibrating for all three targets, you should have the three numbers that you need to plug into the default camera code.

That’s all we got up to for now since we can’t seem to calibrate for all the three target colors.

That is what our team has determined to be the proper steps to calibration after the reading the manual a dozen times.

The only problem we continually our facing is lighting. Our camera can never find the colors that we try to do with a spotlight, flourescent (I know butchered this one) and even nice white lighting.

If anyone out there has their colors calibrated and could help us (and indeed a few other teams :)) it would be appreciated. Specifically, what lighting was used and conditions, methods, etc…? Our team specifically has been trying for a few days now and has seen very little result… Thanks!

Does anyone know what the official colors you need to plug into the camera default code are?

Thx alot

The colors you need to put into the camera code are actually numbers that you get after you calibrate the camera using the provided GUI.

yea i know but our numbers range from 68-88 will this matter and if it will what are the rest of you getting for your calibration numbers

Well, I got some number that worked once, and they worked great until the robot moved… I’ve had the best luck in a dark hallway using 2 500 watt halogen lights to light the target, We successfully got it to chase down a guy carrying a yellow triangle, so you might want to try that

Calibration values will be provided at the competition for their lights, iirc. So it won’t be too much of a problem there, I think.

We wrote our own calibration routines that increment the exposure values and print out the TC packets. Then we set our exposure based on the maximum confidence. It works a lot better than the java GUI. Below is the routine although it’s only been coded for GREEN. We also got much better results when we debounced the tracking flag to drop out on 3 consecutive packets that didn’t meet the minimum pixel (AKA cam.count ) criteria. Cam is working super for us here on team 11. (M.O.R.T.) We’re using the camera servo position and a multiplier for active feedback to the drive train and have multiple virtual windows (“VW”) and multiple servo pan settings from coarse to superfine( “SP”);

void find_exposure( int color )
{
if(calibrate_running == 0) {

	camera_stop();          				// Stop the camera if it is already tracking
  	camera_reset();      					// Reset the camera, and make sure it reset (actually check for true return)
	camera_const_cmd(noise_filter);			// Enable the same noise filter for all tracking
	camera_const_cmd(raw_mode);    			// Put into raw mode, this makes it send output numbers as bytes instead
	camera_const_cmd(virtual_window);
	calibrate_running = 1;

	printf("Calibrating for ");
	switch(color) {
  		case GREEN:
   			printf("GREEN\r");
		  	camera_const_cmd(aec_disable ); 	// Disable AEC
		  	camera_const_cmd(manual_agc ); 	// Enable manual AEC and AGC
			camera_const_cmd(noise_filter ); // Set noise filter to 6 pixels
	  		camera_const_cmd(raw_mode ); 	// Set camera output to BINARY
			camera_const_cmd(virtual_window);			// Set virtual window
			camera_const_cmd(yCrCb_mode);		// Set yCrCb mode
			camera_set_exposure(0);			// Set manual exposure value
	    	camera_const_cmd(track_green);
			best_confidence = 0;
			best_exposure = 0;
			one_second_delay = 0;
		break;

  	default:
		return;
	}
return;
}

if(exposure_val == 255) {
	printf("Best Exposure is %d, Best Confidence is %d\r", best_exposure, best_confidence);
	camera_stop();
	camera_set_exposure( best_exposure );
	camera_auto_servo(SUPERFINE_TRACKING, SUPERFINE_TRACKING);	// Pan.servo = COARSE, Tilt still COARSE
	camera_const_cmd("TC");
	parse_mode = 1;		
	while(1);
}

if(camera_track_update( )) 			// If we have a new frame
{
	num_of_frames++;

// printf(“Exposure= %03d Pixel Count = %03d, Confidence = %03d\r”, exposure_val, cam.count, cam.conf);
if( cam.count > 1 ) {
num_of_samples++;
confidence_average += cam.conf;
pixel_average += cam.count;
}
}

if(one_second_delay++ >= 9) {
	one_second_delay = 0;
	pixel_average = pixel_average/num_of_samples;
	if(pixel_average < 0 ) pixel_average = 0;
	confidence_average = confidence_average/num_of_samples;
	if(confidence_average < 0 ) confidence_average = 0;

	printf("FPS= %03d Exposure = %03d, Pixel Average = %03d, Conf Average = %03d\r", num_of_frames * 4, exposure_val, pixel_average, confidence_average);
	if ((confidence_average/num_of_samples) > best_confidence ) {
		best_confidence = confidence_average/num_of_samples;
		best_exposure = exposure_val;
	}
	exposure_val++;
	num_of_samples = 0;
	num_of_frames= 0;
	confidence_average = 0;
	pixel_average = 0;
	camera_stop();
	camera_set_exposure( exposure_val );
	camera_const_cmd("TC");
	parse_mode = 1;		
}

}

WOW. if only I was able to understand more than a third of it, It would be even nicer.
since I didn’t understand most of it, could you please explain how can I do the same for other colors? do I just add a new case and make caera_tack_color track another color? or is it more compliciated?

No…It’s as simple as filling in the case statements for the other colors. I’ll help you get this running if you want. There are also a few modified functions that were re-written like set_exposure( ) and auto_servo( ).

Let me know if you’re interested and I’ll clean it up for you. The code could be simplified and use a lot less variables, so let me do this for you before you type it in. We’re even thinking of running some of our own calibration routines during practice rounds and then saving the data to EEPROM so we can dump it out to a program and then decide our own exposure values.

if the java gui does work but you still can’t calibrate, try lining the camera up w/o using the servos because when you hit calibrate the servo resets to 0. We are only just now realizing this after weeks of frustration.

edit

There is a new version of the LabVIEW CMUCam Application posted here that has some more options when it comes to selecting colors for tracking. You can also view the color channels individually to better understand what information is contained in each channel.

Cheers!
-Joe

Some Qs:

  1. will the officials release exposure values before the match this year just like they did last year? Has this been documented? Can you provide a link?
  2. Does the Labview GUI have a calibration scheme?

I ask because I believe that last years calibration won’t help this years game to distinguish between green light and any other light source. Exposure values will only adjust how much light enters the camera; it won’t help you distinguish between red, blue, and green colors.

Your thought?

hmm… did you read the calibration guide? that is how we got the camera to work.
with the CMUcam2 GUI for LabView, they include a file called “2006 target”. this includes the color values that have been prechosen for the camera (by ifi or first i think).
also,. you have gotta play around with the SATURATION and NOISE FILTER values. they are the major problems that we had.
also, make sure that your target has a sufficiently charged battery hooked up to it.