Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   FRC Camera code in YCrCb Mode? (http://www.chiefdelphi.com/forums/showthread.php?t=41828)

Terry Sherman 14-01-2006 10:50

FRC Camera code in YCrCb Mode?
 
It seems to me that the default 2006 Camera Code provided by Kevin Watson (Thanks Kevin) is configured for YCrCb. Is that true? The students haven't found a way to change the color modes within the robot controller code. We haven't gotten our Green Light built yet so we've been trying to track in RGB without any success. It tracks just fine using the LabVIEW program when selected as RGB. We use Kevin's handy menu system to store these parameters gotten from LabVIEW into the Robot Controller's EEPROM but the robot controller does not successfully track based on those parameters (hence our thought that the default camera code utilizes YCrCb instead of RGB). Any help on how to change the color modes would be greatly apreciated!

Thanks,
-Terry

Kevin Watson 14-01-2006 14:43

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Terry Sherman
It seems to me that the default 2006 Camera Code provided by Kevin Watson (Thanks Kevin) is configured for YCrCb. Is that true?

Yes, it's setup for YCrCb tracking. To change it to RGB you'll need to get a copy of the camera module data sheet from my website and figure out which bits to twiddle in the advanced settings portion of the camera header file and/or camera menu. If I remember correctly, the bits are in the COMA register.

-Kevin

bear24rw 14-01-2006 17:32

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Kevin Watson
Yes, it's setup for YCrCb tracking. To change it to RGB you'll need to get a copy of the camera module data sheet from my website and figure out which bits to twiddle in the advanced settings portion of the camera header file and/or camera menu. If I remember correctly, the bits are in the COMA register.

-Kevin

wow... wish i knew that 4 hours ago... we have been trying to use the camera with RGB values this whole time...

It tracks perfectly now :)

Eldarion 14-01-2006 17:35

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Kevin Watson
If I remember correctly, the bits are in the COMA register.
-Kevin

Yes, set COMA (Register 18) to equal 8 (enable raw mode).

The camera command would be "CR 18 8" for RGB, and "CR 18 0" for YCrCb.

Kevin Watson 14-01-2006 17:53

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Eldarion
Yes, set COMA (Register 18) to equal 8 (enable raw mode).

The camera command would be "CR 18 8" for RGB, and "CR 18 0" for YCrCb.

You can try this right from the camera menu. Just select the COMA register, enter the new value, hit enter, save changes, and then restart the camera. You should now be using RGB color space.

-Kevin

Damian Manda 15-01-2006 14:27

Re: FRC Camera code in YCrCb Mode?
 
I think we were having this same problem, as we could not get the camera to track when connected to the robot with either the default values or those found in LabVIEW (it tracked fine when driving the servos itself, but I only tried RGB mode). I'll have to wait until tomorrow to test it, though.

Are the calibrations still in R,G,B maximum and minimum values, as this is the only option that I can find in the camera configuration? If so, do I just calibrate the RGB values through LabVIEW (in YCrCb mode) and then enter them into camera.h here:
Code:

#define R_MIN_DEFAULT        85        // Rmin for call to Track_Color()
#define R_MAX_DEFAULT        115        // Rmax for call to Track_Color()
#define G_MIN_DEFAULT        15        // Gmin for call to Track_Color()
#define G_MAX_DEFAULT        17        // Gmax for call to Track_Color()
#define B_MIN_DEFAULT        100 // Bmin for call to Track_Color()
#define B_MAX_DEFAULT        145 // Bmax for call to Track_Color()

i.e, Am I supposed to still calibrate as RGB values in YCrCb mode? The workbook seems to indicate this, but it does not give instructions for entering the calibration into anything other than easyC.

Joe Hershberger 15-01-2006 15:36

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Damian Manda
I think we were having this same problem, as we could not get the camera to track when connected to the robot with either the default values or those found in LabVIEW (it tracked fine when driving the servos itself, but I only tried RGB mode). I'll have to wait until tomorrow to test it, though.

Are the calibrations still in R,G,B maximum and minimum values, as this is the only option that I can find in the camera configuration? If so, do I just calibrate the RGB values through LabVIEW (in YCrCb mode) and then enter them into camera.h here:
Code:

#define R_MIN_DEFAULT        85        // Rmin for call to Track_Color()
#define R_MAX_DEFAULT        115        // Rmax for call to Track_Color()
#define G_MIN_DEFAULT        15        // Gmin for call to Track_Color()
#define G_MAX_DEFAULT        17        // Gmax for call to Track_Color()
#define B_MIN_DEFAULT        100 // Bmin for call to Track_Color()
#define B_MAX_DEFAULT        145 // Bmax for call to Track_Color()

i.e, Am I supposed to still calibrate as RGB values in YCrCb mode? The workbook seems to indicate this, but it does not give instructions for entering the calibration into anything other than easyC.

Remember that when you change color domains, the meaning of the registers change, but the names do not. For this reason, it can be a bit misleading when using the "other color space" (i.e. not the one for which the registers are named). When you are YCrCb mode, the registers have the following meaning:

Code:

R.min = Cr.min
R.max = Cr.max
G.min = Y.min
G.max = y.max
B.min = Cb.min
B.max = Cb.max

Make sure that whatever color space you use to find your values in the Labview CMUcam2 Application is the same color space you use on the camera in the RC code. Also don't forget that when you change modes in the LabView CMUcam2 Application, you need to upload the settings to the camera before they will take effect.

Hope this helps to clarify.

-Joe

Damian Manda 15-01-2006 17:50

Re: FRC Camera code in YCrCb Mode?
 
Thanks for clarifying, I figured that they would change. I just didn't know if there was some other place with constants for YCrCb mode that I was missing. No I have something to test out tomorrow.

Terry Sherman 16-01-2006 23:47

Re: FRC Camera code in YCrCb Mode?
 
Thanks! We finally got our Green Light fromt the kit going (we had troubles buying the proper case for it). With YCrCb we are getting good results!
-Terry

6600gt 25-01-2006 16:43

Re: FRC Camera code in YCrCb Mode?
 
Quote:

Originally Posted by Kevin Watson
You can try this right from the camera menu. Just select the COMA register, enter the new value, hit enter, save changes, and then restart the camera. You should now be using RGB color space.

-Kevin

Is this new value 8? Just want to make sure.

Thanks


All times are GMT -5. The time now is 14:10.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi