|
Re: Target tracking in Java
RGB and HSL are equivalent for identifying a color point. They differ when specifying a color volume.
RGB colors represent a color cube between 0 and 255 generally. Any range of colors winds up being a smaller cube.
HSL colors represent a double cone (two ice cream cones) one right side up and one upside down with the circles touching. This seems like a very odd shape at first, but it is basically a cylinder where the circular end caps are shrunk to points.
The HSL range can describe circular disks, a circular ribbon and tilted circular shapes sort of like you'd get if you were being creative carving up a melon.
The types of color ranges you often want to specify are less sloppy using HSL, HSV, or HSI than RGB. As an example, to include the saturated rainbow colors, you can use HSL range such as (0-255, 225-255, 100-150). The HSL shape is basically a donut. To do this operation in RGB is no longer a numeric range, but a function that looks at terms such as the average and spread of the RGB elements and includes the color if the average is between 150 and 200 and the difference is at least 150 or so. Even this may not be accurate enough, as it may include more pastel colors. Pretty soon you are doing the same as converting the color to HSL using something like the Foley and van Dam conversion algorithm.
Speaking of which, I have heard that the HSL and HSV implementations in IMAQ are quite different in term of performance and accuracy. I haven't tested it in awhile to see if it is still the case.
Greg McKaskle
|