def rgb2lms(rgb_Nx3, conversionMatrix=None):
 rgb_3xN = numpy.transpose(rgb_Nx3)
 if (conversionMatrix is None):
  cones_to_rgb = numpy.asarray([[4.97068857, (-4.14354132), 0.17285275], [(-0.90913894), 2.15671326, (-0.24757432)], [(-0.03976551), (-0.14253782), 1.18230333]])
  logging.warning('This monitor has not been color-calibrated. Using default LMS conversion matrix.')
 else:
  cones_to_rgb = conversionMatrix
 rgb_to_cones = numpy.linalg.inv(cones_to_rgb)
 lms = numpy.dot(rgb_to_cones, rgb_3xN)
 return numpy.transpose(lms)

def rgb2lms ( rgb_Nx3 , conversionMatrix = None ) : rgb_3xN = numpy . transpose ( rgb_Nx3 ) if ( conversionMatrix is None ) : cones_to_rgb = numpy . asarray ( [ [ 4.97068857 , ( - 4.14354132 ) , 0.17285275 ] , [ ( - 0.90913894 ) , 2.15671326 , ( - 0.24757432 ) ] , [ ( - 0.03976551 ) , ( - 0.14253782 ) , 1.18230333 ] ] ) logging . warning ( 'This monitor has not been color-calibrated. Using default LMS conversion matrix.' ) else : cones_to_rgb = conversionMatrix rgb_to_cones = numpy . linalg . inv ( cones_to_rgb ) lms = numpy . dot ( rgb_to_cones , rgb_3xN ) return numpy . transpose ( lms )
convert from rgb to cone space .