histogram_plot



In [ ]:
from read_video import * 
import numpy as np
import matplotlib.pyplot as plt
import cv2
%matplotlib inline

In [ ]:
video_to_read = "/Users/cody/test.mov"
max_buf_size_mb = 50; 
frame_buffer = ReadVideo(video_to_read, max_buf_size_mb, False)
print("Number of bytes in frame_buffer = %d."%frame_buffer.nbytes)

In [ ]:
print("Numpy version.")
%time n, bins = np.histogram(frame_buffer[0], 256)
opencv_hist = np.zeros([frame_buffer.shape[0], 256]); 
cv2.calcHist(frame_buffer[0], opencv_hist, mask=None, histSize=[30,32], 
            ranges=[0, 256])

plt.hist(n, bins)
plt.show()

In [ ]:
frame_buffer[0,:]

In [ ]:
plt.imshow(frame_buffer[-1, :])
plt.set_cmap('gray')
plt.show()

In [ ]: