From 02db159517b892e96430302993bd12a975cbc725 Mon Sep 17 00:00:00 2001 From: amitjans <amitjans@ethz.ch> Date: Wed, 9 Jun 2021 12:07:12 +0200 Subject: [PATCH] Increase blob size, fix errors. --- .vscode/launch.json | 7 ------- app.py | 2 ++ settings.py | 2 +- tools.py | 9 +++++---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index ca5e2eb..17e15f2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,13 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": "Python: Main File", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/main.py", - "console": "integratedTerminal" - }, { "name": "Python: Current File", "type": "python", diff --git a/app.py b/app.py index b1c5f47..15c3597 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,6 @@ """Stream output of main.py script to index.html""" +# import matplotlib +# matplotlib.use('tkagg') import threading import cv2 from flask import Flask, render_template, Response diff --git a/settings.py b/settings.py index 4bd6c55..6366ac4 100644 --- a/settings.py +++ b/settings.py @@ -30,7 +30,7 @@ SHAPE = (960, 1280, 3) TYPE = np.uint16 # Blob detection size -BLOB_SIZE = 8 +BLOB_SIZE = 9 # Region of interest of the image REGION = np.array([[8, 466], [1260, 638]]) diff --git a/tools.py b/tools.py index 14ae2cb..b10883b 100644 --- a/tools.py +++ b/tools.py @@ -66,7 +66,6 @@ class Main: """ Apply the processing on the images. """ - warnings.simplefilter("once", UserWarning) while True: dist_factor = read_factor(self.conn) image = load_image() @@ -118,6 +117,8 @@ class Main: if len(coord) > 0: roundness = ion_roundness(img, coord[0][:2]) img = compensate_gradient(img, coord) + else: + roundness = -1 max_int, num_pix = max_ion_intensity(img, coord) coord = detect_dim_ions(img, coord, max_int) linearity = ion_linearity(coord) @@ -582,9 +583,9 @@ def dark_ions(image, coord, dist_factor): coord = coord[coord[:, 1].argsort()].astype(int) coord = coord[coord[:, 1] < image.shape[1]] # remove points outside the image - if loss.min() > 20: - warnings.warn("Loss is too high... " - "Try calculating a new factor value using calibrate() function.") + # if loss.min() > 20: + # warnings.warn("Loss is too high... " + # "Try calculating a new factor value using calibrate() function.") return coord -- GitLab