From a154c6ef1010a4389758281d3054a2a6ac277694 Mon Sep 17 00:00:00 2001 From: amitjans <amitjans@ethz.ch> Date: Tue, 13 Jul 2021 00:05:57 +0200 Subject: [PATCH] Changed number of measured pixels for gradient compensation (from 60 to 30). Changed intensity threshold for dim ion detection --- settings.py | 2 +- tools.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/settings.py b/settings.py index 8821419..b59cb0e 100644 --- a/settings.py +++ b/settings.py @@ -18,7 +18,7 @@ DB_DATASET = 'barium' ION_DIST = 15 # Relative intensity threshold to differentiate good/bad isotopes (w.r.t. to max intensity) -INT_THS = 0.55 +INT_THS = 0.45 # Number of iterations before restarting the position's memory NUM_ITERATIONS = 5 diff --git a/tools.py b/tools.py index 040c005..ab4454a 100644 --- a/tools.py +++ b/tools.py @@ -755,6 +755,7 @@ def plot_detection(image, points): Code the image into bytes and return it. """ image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR) + for point in points: if point[2] != 2: overlay = image.copy() @@ -920,11 +921,11 @@ def _measure_gradient(image, coord): y = [] x = [] for pos in coord: - y.append(np.sum(image[pos[0] - 30 : pos[0] + 30, pos[1]], axis=0)) + y.append(np.sum(image[pos[0] - 15 : pos[0] + 15, pos[1]], axis=0)) x.append(pos[1]) m, _ = np.polyfit(x, y, deg=1) - return m/60 + return m/30 def _ion_intensity(image, center): -- GitLab