|
Title: RBY colour space Post by: Juju on December 26, 2014, 06:21:28 PM I've been intrigued by using RYB as a natural way to create colour palettes. Fortunately, there's enough help out there (and research papers) to quite easily find a solution for RYB to RGB conversion using either a "dumb" direct method or the mathematically complex cubic interpolation method. The former is basically no more nuanced than simply using RGB to begin with and defeats the point of having another colour space to begin with. The cubic interpolation model (nicely summed up here: http://bahamas10.github.io/ryb/about.html) is surprisingly simple in terms of the arithmetic but present a problem:
Once in RGB how do you get back to RYB? This page gives a tantalising taste of the solution: http://stackoverflow.com/questions/4945457/conversion-between-rgb-and-ryb-color-spaces What's desperately frustrating is that the suggested answer, a Jacobian matrix and Newton-Raphson to find some roots, is provided without code. My knowledge of maths is not where it needs to be to tackle the problem in this manner. I think a blind iterative method may be more appropriate, making an educated guess based on pre-computed values and then naively nudging along the three axes. Opinions? Title: Re: RBY colour space Post by: Cheesegrater on December 26, 2014, 07:03:55 PM It won't converge as quickly as Newton's method, but rather than nudging randomly you should be able to use a Hill climbing algorithm (https://en.wikipedia.org/wiki/Hill_climbing) to find an answer.
Title: Re: RBY colour space Post by: jgrams on December 27, 2014, 04:36:08 PM Can I ask what your level of math knowledge is? Maybe we could walk you through the process of figuring the Jacobian and doing the Newton-Raphson refinement? It's not too difficult; it's more just tedious (unless you use a computer algebra system of some kind). And that understanding might (possibly?) stand you in good stead for other problems later...?
Edit: Aaaand...because I can never resist trying to explain math to people... http://www.arestlessmind.org/2014/12/28/ryb-to-rgb.jpg (http://www.arestlessmind.org/2014/12/28/ryb-to-rgb.jpg) (sorry it's all in pencil: for some reason I don't have a convenient way to typeset math on this computer). You can gloss over the "curly-backwards-d" partial derivative symbol, you don't need to fully understand what it means. So I think this reduces it to just needing basic algebra, but if anything isn't clear (or if someone notices that I screwed something up), let me know. Title: Re: RBY colour space Post by: Gtoknu on December 27, 2014, 06:41:39 PM Why are you wanting to work with RYB color space? I'm not criticizing, just curious.
The reason I'm asking this is because I develop a pixel art editor in my free time. If this has some real benefical effects, I may implement it along with the color spaces it already supports (RGB, CMYK, HSB and HUSL.) Title: Re: RBY colour space Post by: Fallsburg on December 29, 2014, 09:32:10 AM (sorry it's all in pencil: for some reason I don't have a convenient way to typeset math on this computer) www.writelatex.com ? Or any of the other online latex compilers? Title: Re: RBY colour space Post by: jgrams on December 29, 2014, 01:28:31 PM D'oh! Guess I've got to pull myself out of the '90s... :facepalm: ;)
|