how to directly convert between HSB color and Lab color in Processing / Java

359 Views Asked by At

I am trying to convert back and forth between HSB color and Lab color in Processing / Java. I know that I can first convert HSB to RGB then to Lab, is it possible to directly convert from HSB to Lab? If so, how to do that?

1

There are 1 best solutions below

1
On

Unfortunately I can't provide a detailed answer.

There are fomulas of course: HSB, CIE XYZ as you'll need for sRGB to CIE XYZ to then convert CIE XYZ to Lab*. I'm sure you find implementations out

In terms of Java/Processing perhaps there is something already out there. FWIW you can check out this older example of mine using OpenFrameworks.

search images by dominant colour demo

OpenFrameworks is to c++ as what Processing is to Java. Hopefully you'll have no trouble swapping struct for class and #define for float, etc. The syntax is not that different in this case.