Beispiel #1
0
def test_rgb_to_husl():
    rgb_arr = _img()
    husl_new = _nphusl._rgb_to_husl(rgb_arr)
    for row in range(rgb_arr.shape[0]):
        for col in range(rgb_arr.shape[1]):
            husl_old = _ref_to_husl(rgb_arr[row, col])
            _diff_husl(husl_new[row, col], husl_old)
Beispiel #2
0
def test_rgb_to_husl_3d():
    rgb_arr = np.ascontiguousarray(_img()[:5, :5])
    float_arr = transform.ensure_rgb_float(rgb_arr)
    husl_new = _nphusl._rgb_to_husl(rgb_arr)
    for row in range(husl_new.shape[0]):
        for col in range(husl_new.shape[1]):
            husl_old = husl.rgb_to_husl(*float_arr[row, col])
            _diff_husl(husl_new[row, col], husl_old)
Beispiel #3
0
def test_lch_to_husl():
    rgb_arr = _img()
    lch_arr = _nphusl._rgb_to_lch(rgb_arr)
    hsl_from_lch_arr = _nphusl._lch_to_husl(lch_arr)
    hsl_from_rgb_arr = _nphusl._rgb_to_husl(rgb_arr)
    _diff_husl(hsl_from_lch_arr, hsl_from_rgb_arr)
    for i in range(rgb_arr.shape[0]):
        old_lch = _ref_to_lch(rgb_arr[i, 0])
        _diff(lch_arr[i, 0], old_lch)
Beispiel #4
0
def test_to_hue_3d():
    img = _img()  # 3D
    as_husl = _nphusl._rgb_to_husl(img / 255.0)
    just_hue = nphusl.to_hue(img)
    _diff(as_husl[..., 0], just_hue)
Beispiel #5
0
def test_husl_to_rgb():
    img = np.ascontiguousarray(_img()[25:, :5])
    husl = _nphusl._rgb_to_husl(img)
    rgb = transform.ensure_rgb_int(_nphusl._husl_to_rgb(husl))
    _diff(img, rgb)