我有一个CIEXYZ_to_RAW矩阵,它包含将xyz坐标转换为原始rgb值的值。我必须找到原色和白色的坐标。
CIEXYZ_to_RAW = [[ 0.902 -0.289 -0.0715],
[-0.4535 1.2436 0.2348],
[-0.0934 0.1919 0.7086]]
Camera white balance coefficients: [0.59967933 1.06821928 1.92359299]
我有这个,但它没有给予我正确的结果:
CIEXYZ_r = np.array([1, 0, 0]) # Rood
CIEXYZ_g = np.array([0, 1, 0]) # Groen
CIEXYZ_b = np.array([0, 0, 1]) # Blauw
CIEXYZ_w = np.array([1/3, 1/3, 1/3]) # whitepoint
# calculate the RGB-values of the three primary colors and the whitepoint
RAW_r = np.dot(CIEXYZ_to_RAW, CIEXYZ_r)
RAW_g = np.dot(CIEXYZ_to_RAW, CIEXYZ_g)
RAW_b = np.dot(CIEXYZ_to_RAW, CIEXYZ_b)
RAW_w = np.dot(CIEXYZ_to_RAW, CIEXYZ_w)
# use the white balance coefficients
RAW_r *= camera_wb_coeff
RAW_g *= camera_wb_coeff
RAW_b *= camera_wb_coeff
RAW_w *= camera_wb_coeff
# normalise the RGB-values
RAW_r /= RAW_w.sum()
RAW_g /= RAW_w.sum()
RAW_b /= RAW_w.sum()
RAW_w /= RAW_w.sum()
# Convert the RGB-values to the xy-coordinates
RAW_r_xy = RAW_r[:2] / RAW_r.sum()
RAW_g_xy = RAW_g[:2] / RAW_g.sum()
RAW_b_xy = RAW_b[:2] / RAW_b.sum()
RAW_w_xy = RAW_w[:2] / RAW_w.sum()
1条答案
按热度按时间bxjv4tth1#
Colour有
colour.primaries_whitepoint
的定义。如果你传递一个RGB色彩空间的归一化主矩阵(NPM),它将返回它的原色和白点。关于CIEXYZ_to_RAW
矩阵是如何导出的,缺乏上下文,所以你可以做以下事情: