View Single Post
  #2   Spotlight this post!  
Unread 18-03-2009, 05:36
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Camera bug and Suggestions to locate green

Quote:
Originally Posted by Green2 View Post
I think the issues resides in the code where it takes an RGB image and convert it to HSL for color detection. At times, the resulting HSL image will output a red/pink hue value that is in the single digits (normal red/pink hue is supposed to be from 220 to 255, but the converted HSL image will indicate some red/pink pixels are in the range of 1 to 5. This usually occurs when the target hue value is near the higher value of 255. The only conclusion that I can make is that there is a bug in the conversion code where it is not converting the red hue range properly. I believe that this bug is causing pink detection to fail at times. When pink fails, green natually also fails.
If this is the case, the bug is in the color threshold, not necessarily the HSL conversion. Hue in HSL is defined to be a continuous cycle, much the same way that an angle measurement is continuous: 360 degrees is "adjacent to" 359 degrees, but it can also be said to be "adjacent to" 1 degree. There are two options to that could be used to compensate for this: use a piecewise threshold, one piece for 220-255 and another for 0-5, or before you threshold for pink, shift all the hue values by ~100 mod 255, i.e. Hue' (hue prime) = Hue + 100 mod 255. If you're using LabVIEW, use the remainder output from the Quotient and Remainder function. Then just threshold for 65-105 or whichever range you need.

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote