Ejemplo n.º 1
0
def plot_colorspace_gamut(colorspace, color=None, draw_lines=True,
                          lines_color='black', fill=False,
                          upvp_conversion=False):
    """Plot colorspace primaries triangle

    Args:
        colorspace (utils.colorspace)

    kwargs:
        color (str): if none, 1st point--> red, 2nd --> green, 3rd -> blue

        drawLines (bool): draw outline

        fill (bool): fill triangle

        upvp_coords (bool): if true, convert x,y values into u'v' values

    """
    red_x, red_y = colorspace.get_red_primaries()
    green_x, green_y = colorspace.get_green_primaries()
    blue_x, blue_y = colorspace.get_blue_primaries()
    if upvp_conversion:
        red_x, red_y = coh.xy_to_upvp([red_x, red_y])
        green_x, green_y = coh.xy_to_upvp([green_x, green_y])
        blue_x, blue_y = coh.xy_to_upvp([blue_x, blue_y])
    plot_triangle(np.array([red_x, green_x, blue_x]),
                  np.array([red_y, green_y, blue_y]),
                  color, draw_lines, lines_color, fill,
                  colorspace.__class__.__name__)
Ejemplo n.º 2
0
def plot_colorspace_gamut(colorspace, color=None, draw_lines=True,
                          lines_color='black', fill=False,
                          upvp_conversion=False):
    """Plot colorspace primaries triangle

    Args:
        colorspace (utils.colorspace)

    kwargs:
        color (str): if none, 1st point--> red, 2nd --> green, 3rd -> blue

        drawLines (bool): draw outline

        fill (bool): fill triangle

        upvp_coords (bool): if true, convert x,y values into u'v' values

    """
    red_x, red_y = colorspace.get_red_primaries()
    green_x, green_y = colorspace.get_green_primaries()
    blue_x, blue_y = colorspace.get_blue_primaries()
    if upvp_conversion:
        red_x, red_y = coh.xy_to_upvp([red_x, red_y])
        green_x, green_y = coh.xy_to_upvp([green_x, green_y])
        blue_x, blue_y = coh.xy_to_upvp([blue_x, blue_y])
    plot_triangle(np.array([red_x, green_x, blue_x]),
                  np.array([red_y, green_y, blue_y]),
                  color, draw_lines, lines_color, fill,
                  colorspace.__class__.__name__)
Ejemplo n.º 3
0
def plot_spectrum_locus_76():
    """Plot CIE1976 spectrum locus

    """
    # Load CIE 1931 data
    x_list, y_list = load_xy_from_file(SPECTRUM_LOCUS_31)
    up_list = []
    vp_list = []
    # Convert data from xy to u'v"
    for x, y in zip(x_list, y_list):
        up, vp = coh.xy_to_upvp([x, y])
        up_list.append(up)
        vp_list.append(vp)
    up_list = np.array(up_list)
    vp_list = np.array(vp_list)
    # Plot resulting data
    plot_spectrum_locus(up_list, vp_list, "spectrum locus CIE1976")
Ejemplo n.º 4
0
def plot_spectrum_locus_76():
    """Plot CIE1976 spectrum locus

    """
    # Load CIE 1931 data
    x_list, y_list = load_xy_from_file(SPECTRUM_LOCUS_31)
    up_list = []
    vp_list = []
    # Convert data from xy to u'v"
    for x, y in zip(x_list, y_list):
        up, vp = coh.xy_to_upvp([x, y])
        up_list.append(up)
        vp_list.append(vp)
    up_list = np.array(up_list)
    vp_list = np.array(vp_list)
    # Plot resulting data
    plot_spectrum_locus(up_list, vp_list, "spectrum locus CIE1976")