Go to Post anything that breaks a kitbot frame is probably breaking most custom frames of similar weight, too. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2007, 23:05
Thanatos Thanatos is offline
Registered User
FRC #1890
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Tennessee
Posts: 2
Thanatos is an unknown quantity at this point
WPILib & Camera colors & data

After countless times of me waving bright lights at the camera, I think I've finally got the camera to follow it. (After having it run away from lights...) However, I'm still confused when it comes to WPILib's CameraInitializationData structure... so many members. The three that most concern me are the first six, which WPILib's API.h labels as:
Code:
unsigned char redMin, redMax, greenMin, greenMax, blueMin, blueMax;
The WPILib website has this line from their "tracking FRC green target" sample:
Code:
{ 85,115,15,17,100,145,0,1,0,1,0,0,128,128,128,1,16,8,5,30,15,5 }
Now, I'm reading this as:
red = 85 to 115
green = 15 to 17
blue = 100 to 145
I'm assuming that the topmost range for the min/max is 255. (is this correct?) Using that, that seems to be a dark purple. Certainly not green. Taking raw pictures with the camera also seems to say the only the outer fridges of the light are green - the center is pure white (over expose?). (We haven't taken pictures from a distance... we just got the lights wired in a way that they're actually mobile...) The problem is that nothing I use seems to work. That array does. Why?

Also, what are all the pan and tilt values near the end of the initialization array? Should the camera be sending back pan/tilt values in the TPacket? (Are these leftovers from a previous year when the servos were plugged into the camera itself?) (I seem to get 127 or 128 (can't remember) all the time, or 0 if there's a connection failure.) I'm currently using mx and my to compute a servo offset.

Thanks in advance for all the help... I hope I haven't missed something somewhere. (It took me a while to find the lens on the camera...)
  #2   Spotlight this post!  
Unread 18-02-2007, 23:58
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: WPILib & Camera colors & data

The "dark purple" is what you get if you think of the values as RGB and fail to interpret them in the YCrCb color space instead. The camera picks up on the green glowing color wonderfully if it's switched to YCrCb, which is what the provided code does.

By the way, the maximum reported color value from the camera is 240. In RGB mode, a sufficiently bright light of any color -- including the green target light -- saturates the camera at 240,240,240.
  #3   Spotlight this post!  
Unread 19-02-2007, 01:15
Thanatos Thanatos is offline
Registered User
FRC #1890
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Tennessee
Posts: 2
Thanatos is an unknown quantity at this point
Re: WPILib & Camera colors & data

Didn't think of that, and that would explain it. However, the 7th element in the array is called "YCrCb" and is set to 0 by the example code - does 0 mean use YCrCb? That'd seem a bit backwards. Does 1 mean RGB? *continues to read Wikipedia article on YCbCr*

Our team was trying to track a yellow Poof ball at first, as we were having trouble with the lights. Now that we have light, I suppose I'll stick with the example, since it works. (Can't argue with working stuff...) I'd still like to understand.

Thanks again!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems when combine ADC code && camera code nirhaim1942 Programming 1 24-01-2007 06:58
pic: The Bobcats 2001 & 2003 & Admirers CD47-Bot Robot Showcase 19 28-02-2004 12:36
Team Mascots, Nickname & Colors? DanLevin247 General Forum 84 22-07-2003 00:14
Sprocket & Gear Data archiver 2000 1 23-06-2002 22:43
Website & Data now LiVE! MotoMidWest soap108 Regional Competitions 2 29-03-2002 11:59


All times are GMT -5. The time now is 04:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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