Beispiel #1
0
def plot_neighbors_frequencies():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    x_title = 'Time (Seconds)'
    y_title = 'Frequency'
    titles = [
        'One neighbour', 'Two neighbours', 'Three neighbours',
        'Four neighbours', 'Five neighbours', 'Six neighbours'
    ]
    labels = ["F", "I"]
    fig, axs = plt.subplots(3, 2)
    axs = axs.ravel()
    i = 1

    for idx, ax in enumerate(axs):
        constants.NUMBER_OF_NEIGHBOR_VIDEOS = idx + 1
        intro_median, matches, matches_intro = video_matcher.get_matches(
            COMPFILE)
        data_matches = get_data_for_plotting(matches)
        data_matches_intro = get_data_for_plotting(matches_intro)
        ax.hist(data_matches, bins=40, label=labels[0], fc='blue')
        ax.hist(data_matches_intro, bins=40, label=labels[1], fc='orange')
        ax.set_title(titles[idx])
        ax.set_xlabel(x_title)
        ax.set_ylabel(y_title)
        ax.set_ylim(0, 130)
        ax.set_xlim(0, 480)
        ax.legend(loc='upper right')
        ax.grid()
    plt.tight_layout()
    plt.show()
Beispiel #2
0
def plot_diff_threshold_hashes():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    x_title = 'Time (Seconds)'
    y_title = 'Frequency'
    titles = [
        'Threshold equals 3', 'Threshold equals 4', 'Threshold equals 5',
        'Threshold equals 6'
    ]
    labels = ["F", "I"]
    fig, axs = plt.subplots(2, 2)
    axs = axs.ravel()
    i = 1

    for idx, ax in enumerate(axs):
        constants.HASH_CUTOFF = idx + 3
        intro_median, matches, matches_intro = video_matcher.get_matches(
            COMPFILE)
        data_matches = get_data_for_plotting(matches)
        data_matches_intro = get_data_for_plotting(matches_intro)
        ax.hist(data_matches, bins=40, label=labels[0], fc='blue')
        ax.hist(data_matches_intro, bins=40, label=labels[1], fc='orange')
        ax.set_title(titles[idx])
        ax.set_xlabel(x_title)
        ax.set_ylabel(y_title)
        ax.set_ylim(0, 130)
        ax.set_xlim(0, 480)
        ax.legend(loc='upper right')
        ax.grid()
    plt.tight_layout()
    plt.show()
Beispiel #3
0
def plot_filtering():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    #setup
    x_titles = ['Start time of intro (Seconds)', 'Length of intro (Seconds)']
    y_title = ['Frequency', 'Score']
    titles = [
        'Extraction of matches', 'Extraction of sequences',
        'Choosing best sequence'
    ]
    colors = ['blue', 'orange']
    labels = [["F", "I"], []]

    intro_median, matches, matches_intro = video_matcher.get_matches(COMPFILE)

    #first
    data_matches = get_data_for_plotting(matches)
    data_matches_intro = get_data_for_plotting(matches_intro)

    #second
    sequences_matches = video_matcher.extract_sequences(matches)
    sequences_matches_intro = video_matcher.extract_sequences(matches_intro)

    rects = get_rectangles_seq(sequences_matches, 'blue')
    rects_intro = get_rectangles_seq(sequences_matches_intro, 'orange')

    bins = [40]
    x_data = [[data_matches, data_matches_intro]]
    fig, axs = plt.subplots(1, 2)
    axs = axs.ravel()

    for idx, ax in enumerate(axs):
        if idx == 0:
            x = x_data[idx]
            label = labels[idx]
            ax.hist(x[0], bins=bins[idx], label='F', fc=colors[0])
            ax.hist(x[1], bins=bins[idx], label='I', fc=colors[0])
            ax.set_title(titles[idx])
            ax.set_xlabel(x_titles[idx])
            ax.set_ylabel(y_title)
            ax.legend(loc='upper right')
            ax.grid()
        elif idx == 1:
            plot_sequences_as_rect_axs(ax, fig, rects, rects_intro)
            ax.relim()
            ax.autoscale_view()

    plt.tight_layout()
    plt.show()
Beispiel #4
0
def plot_last_sequence():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    intro_median, matches, matches_intro = video_matcher.get_matches(COMPFILE)
    matches_best_seq = video_matcher.get_best_intro(matches)
    matches_best_seq_intro = video_matcher.get_best_intro(matches_intro)
    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(matches_best_seq)

    rects = get_rectangles_seq(matches_best_seq, 'blue')
    rects_intro = get_rectangles_seq(matches_best_seq_intro, 'orange')
    plot_sequences_as_rect(rects, rects_intro)
Beispiel #5
0
def plot_sequences():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    intro_median, matches, matches_intro = video_matcher.get_matches(COMPFILE)
    sequences_matches = video_matcher.extract_sequences(matches)
    sequences_matches_intro = video_matcher.extract_sequences(matches_intro)

    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(sequences_matches)

    rects = get_rectangles_seq(sequences_matches, 'blue')
    rects_intro = get_rectangles_seq(sequences_matches_intro, 'orange')
    plot_sequences_as_rect(rects, rects_intro)
Beispiel #6
0
def create_graph_freq():
    if COMPFILE is None:
        print(ERROR_MSG)
        exit()

    intro_median, matches, matches_intro = video_matcher.get_matches(COMPFILE)
    data_matches = get_data_for_plotting(matches)
    data_matches_intro = get_data_for_plotting(matches_intro)
    # naming the x axis
    plt.xlabel('Time (Seconds)')
    # naming the y axis
    plt.ylabel('Frequency')
    plt.grid(True)
    plt.hist(data_matches, bins=40, label="F", fc='blue')
    plt.hist(data_matches_intro, bins=40, label="I", fc='orange')
    plt.legend(loc='upper right')
    print(intro_median)