pix
pix
andrew yager.com - andrew's home on the web
 
spacer Home

Wednesday, 07 January 2009

pix
pix
image bar at top of page
pix
pix
pix
Main Menu
Home
Blog
General News
Christianity Stuff
IT Stuff
Personal Stuff
Links
Contact Me
Search
News Feeds
Latest Updates
Who's Online
We have 2 guests online
Login Form





Lost Password?
No account yet? Register
Syndicate

 

 
I learnt something in maths... PDF Print E-mail
Written by Andrew Yager   
Sunday, 09 July 2006
Well -I might not have learnt much, but I did learn something about degrees and radians. So when I was reading the Apple documentation for CoreImage and I stumbled across a curious paragraph, I thought I better check it out.

ADC Home > Reference Library > Documentation > Graphics & Imaging > Quartz > Core Image Programming Guide > Using Core Image Filters >

states: 

Listing 2-5 sets two input parameters—the input image and the input angle. Filters, except for generator filters, require an input image. Some require two or more images or textures. The input angle for the hue adjustment filter refers to the location of the hue in the HSV and HLS color spaces. This is an angular measurement that can vary from 0.0 to 2 pi. A value of 0 indicates the color red; the color green corresponds to pi/3 radians, and the color blue is 2/3 pi radians.

I was first alerted tot he mistake in that the measurements go from 0 -> 2pi, but in fact they had indicated two points that would appear in the first pi radians, and nothing in the second half of the circle. Thinking this is weird I pulled out my handy copy of art directors toolkit to check. pi/3 radians (60 degrees) is yellow, and not green, however 2/3pi radians (120 degrees) is green and not blue.

In fact, apple has made the simple mistake of not thinking in 2pi radian space. The values they are after are 2/3pi radians for green and 4/3pi radians for blue.

So it is with great joy, that I bring you this basic colour conversion table for the hue in an image.

AngleColour
 0 rad (0 degrees)
Red
pi/3 rad (60 degrees)
Yellow
2/3 pi rad (120 degrees) Green
pi rad (180 degrees)
Aqua blue
4/3 pi rad (240 degrees)
Blue
5/3 pi rad (300 degrees)
Pink
2pi rad (360 degrees)
Red
 
< Prev   Next >

pix
pix

copyright 2006 andrew yager and rwts