def three_seven():
    """
    3.7
    Obtain the unnormalized and the normalized histograms of the following 8-bit,
    MxN image.  Give your histogram either in a table or a graph, labeling clearly
    the value and location of each histogram component in terms of M and N.
    Double-check your answer by making sure that the histogram components add to the
    correct value.
    """
    figure_image = np.array([
        [240, 240, 240, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32],
        [240, 240, 240, 16, 16, 16, 228, 32, 32, 32, 32, 32, 255],
        [240, 240, 240, 16, 16, 16, 228, 228, 32, 32, 32, 255, 255],
        [240, 240, 240, 16, 16, 16, 228, 228, 228, 32, 255, 255, 255],
        [240, 240, 240, 16, 16, 16, 228, 228, 228, 0, 255, 255, 255],
        [240, 240, 240, 16, 16, 16, 228, 228, 0, 0, 0, 255, 255],
        [240, 240, 240, 16, 16, 16, 228, 0, 0, 0, 0, 0, 255],
        [240, 240, 240, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0],
        [127, 127, 127, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0],
        [127, 127, 127, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0],
        [127, 127, 127, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0],
    ])

    rows, columns = figure_image.shape

    ImageDisplay.display_image(figure_image)

    histogram = ImageStatistics.calculate_histogram(figure_image)

    # calculate normalized histogram
    counts = 0
    for value in histogram:
        counts += value

    normalized_histogram = histogram / (rows * columns)

    print(histogram)

    plt.hist(figure_image)
    plt.show()

    plt.plot(histogram, label="unnormalized histogram")
    plt.legend()
    plt.show()

    plt.plot(normalized_histogram, label="normalized histogram")
    plt.legend()
    plt.show()