Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xyz_from_rgb not works #3

Open
ChameleonRed opened this issue May 17, 2014 · 0 comments
Open

xyz_from_rgb not works #3

ChameleonRed opened this issue May 17, 2014 · 0 comments

Comments

@ChameleonRed
Copy link

from colorpy import colormodels as cm

class ColorPy(object):
  @staticmethod
  def irgb2lab(r, g, b):
    irgb = cm.irgb_color(r, g, b)
    rgb = cm.rgb_from_irgb(irgb)
    xyz = cm.xyz_from_rgb(rgb)
    lab = cm.lab_from_xyz(xyz)
    return lab

  @staticmethod
  def rgb2lab(r, g, b):
    rgb = cm.rgb_color(r, g, b)
    xyz = cm.xyz_from_rgb(rgb)
    lab = cm.lab_from_xyz(xyz)
    return lab

  @staticmethod
  def rgb2xyz(r, g, b):
    rgb = cm.rgb_color(r, g, b)
    xyz = cm.xyz_from_rgb(rgb)
    return xyz

Try to convert gray rgb_color(.5, .5, .5) should be near ('xyzColorMath', '0.203 0.214 0.233') but is ('xyzColorPy', '0.475 0.500 0.545').
http://www.easyrgb.com/index.php?X=CALC#Result
http://www.workwithcolor.com/

(('rgb', (0.5, 0.5, 0.5), [128.0, 128.0, 128.0]),
 ('xyzColorPy', '0.475 0.500 0.545'),
 ('xyzColorMath', '0.203 0.214 0.233'),
 ('labColorPy', '76.069 0.000 0.000'),
 ('labColorMath', '53.389 -0.000 -0.005'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant