Script execution

This commit is contained in:
gac-S_Changer
2017-06-23 15:35:03 +02:00
parent 973f908007
commit b7d54a5e99

View File

@@ -8,13 +8,11 @@ line = load_image("{images}/line.png", title="Line")
line.getProcessor().setBackgroundValue(0.0)
#renderer = show_panel(line.bufferedImage)
#ip = get_image()
ip = integrate_frames(10)
ip = grayscale(ip, True)
#ip = grayscale(ip, True)
show_panel(ip.bufferedImage)
smooth(ip)
#bandpass_filter(ip, 30, 1000)
@@ -58,7 +56,6 @@ renderer = show_panel(ip.bufferedImage)
#renderer = show_panel(op.bufferedImage)
#line.show()
"""
vals = []
for i in range (180):
l = line.duplicate()
@@ -71,8 +68,31 @@ for i in range (180):
#renderer = show_panel(op.bufferedImage)
#time.sleep(0.001)
plot(vals)
"""
p = plot(vals)[0]
threshold = (min(vals) + max(vals))/2
min_peak_distance = 10.0
xdata=Arr.indexesInt(len(vals))
peaks = estimate_peak_indexes(vals, xdata, threshold, min_peak_distance)
print "Peak indexes: " + str(peaks)
print "Peak x: " + str(map(lambda x:xdata[x], peaks))
print "Peak y: " + str(map(lambda x:vals[x], peaks))
gaussians = fit_gaussians(vals, xdata, peaks)
for i in range(len(peaks)):
peak = peaks[i]
(normalization, mean_val, sigma) = gaussians[i]
if abs(mean_val - xdata[peak]) < min_peak_distance:
print "Peak -> " + str(mean_val)
p.addMarker(mean_val, None, "N="+str(round(normalization,2)), Color(210,0,0))
else:
print "Invalid gaussian fit: " + str(mean_val)
#image_fft(ip)