예제 #1
0
def draw_horizontal_heat_map(image,
                             coordinates,
                             click_settings,
                             min_idx=None,
                             max_idx=None,
                             time_stamps=None,
                             should_copy=False):
    """
    :param time_stamps:     value for timestamps if it should be used
    :param image:           the image data to work with
    :param min_idx:         the index where to start drawing the heatmap
    :param max_idx:         the index where to stop drawing the heatmap exclusive
    :param coordinates:     an array of coordinates (x,y)
    :param click_settings:  the click Settings of the Image
    :param should_copy:     Indicates if the image should be copied b4
    :return:                the modified image data
    """

    im = utils.shallow_or_deep(image, should_copy)

    min_idx = utils.get_normal_on_none(min_idx, 0)
    min_idx = utils.clamp(min_idx, 0, len(coordinates) - 1)

    max_idx = utils.get_normal_on_none(max_idx, len(coordinates))
    max_idx = utils.clamp(max_idx, 1, len(coordinates))

    hmh.draw_horizontal_heatmap(im, min_idx, max_idx, coordinates, time_stamps,
                                click_settings)

    return im
예제 #2
0
def draw_horizontal_line_diagram(image,
                                 coordinates,
                                 min_idx=None,
                                 max_idx=None,
                                 should_copy=False):
    """
    :param image:           the image data to work with
    :param min_idx:         the index where to start drawing the heatmap
    :param max_idx:         the index where to stop drawing the heatmap exclusive
    :param coordinates:     an array of coordinates (x,y)
    :param should_copy:     Indicates if the image should be copied b4
    :return:                the modified image data
    """

    im = utils.shallow_or_deep(image, should_copy)

    min_idx = utils.get_normal_on_none(min_idx, 0)
    min_idx = utils.clamp(min_idx, 0, len(coordinates) - 1)

    max_idx = utils.get_normal_on_none(max_idx, len(coordinates))
    max_idx = utils.clamp(max_idx, 1, len(coordinates))

    # a number to start, 3 otherwise would overlap with the start
    current_y = 3
    current_x = coordinates[min_idx][0]

    for i in range(min_idx, max_idx):
        x = coordinates[i][0]
        im = drw.draw_line(im, (current_x, current_y), (x, current_y),
                           (0, 0, 0, 1))
        current_x = x
        im = drw.draw_line(im, (current_x, current_y),
                           (current_x, current_y + 3), (0, 0, 0, 1))
        current_y += 3

    return im