HSV conversion in a CIFilter
HSV conversion in a CIFilter
I haven't posted for a while - I've been busy coding. Something new in the works that should be available in a month or two. But I do want to quickly publish something I haven't seen documented before, which is how you can do RGB to HSV conversions in a CIFilter. HSV (Hue, Saturation, Value) representations are useful in a number of image manipulations, and CIFilters are part of Apple's image processing in OS X and iOS, and use a reduced version of the OpenGL shader language. In general, HSV conversion in OpenGL shader language are a problem, because of the conditionals, which shader language aren't good at. Some RGB<->HSV conversions in Open GL shader language have been published before, but all the ones I've seen use functions that aren't available in the subset of the shader language that is available in a CIFilter. This implementation takes some ideas about the use of the "step" function from Ian Taylor's "normal" shader language implementation. The CIFilter below adjusts exposure and saturation by converting to HSV, adjusting S and V, and converting back to RGB. You can test this by just pasting it into Quartz Composer. Of course, if all you want to do is to adjust exposure and saturation, there are easier ways than HSV - this is just a demo! Anyway, without more talk:
Popular Posts
Blog Archive
About Me
About Me
My Photo
Author of AccuRaw, PhotoRaw, CornerFix, pcdMagic, pcdtojpeg, dcpTool, WinDat Opener and occasional photographer....
Loading