1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#!/usr/bin/python
import matplotlib.pyplot as plt
import matplotlib.mlab as ml
import numpy as np
import sys
face_filename = sys.argv[1]
data = ml.load(face_filename,delimiter=",",usecols=[3,4])
distance_detected = [float(distance) for (distance,detected) in data if int(detected)>0]
distance = [float(distance) for (distance,detected) in data]
range = (min(distance),max(distance))
hist_detected,bins = np.histogram(distance_detected,bins=30,range=range)
hist,bins = np.histogram(distance, bins=30, range=range)
result = hist_detected*1./hist
plt.bar(bins[1:],result,width=np.diff(bins)[1])
plt.show()
|