From 458998d1f7f0235410995b6804bb06e9b2e33e58 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 19 Apr 2023 16:54:25 +0200 Subject: [PATCH] fixed bug --- clean_python/extractors.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/clean_python/extractors.py b/clean_python/extractors.py index 234b7af..82ee0cf 100644 --- a/clean_python/extractors.py +++ b/clean_python/extractors.py @@ -1,12 +1,13 @@ -import numpy as np +import logging +from abc import abstractmethod, ABC +from tools import clean_bounds_offset +from spin_image import FFT +from cache import persist_to_file, timeit import tqdm +import numpy as np +import matplotlib.pyplot as plt # from scipy.spatial import Voronoi # import cv2 -from cache import persist_to_file, timeit -from spin_image import FFT -from tools import clean_bounds_offset -from abc import abstractmethod, ABC -import logging logger = logging.getLogger("fft") @@ -76,11 +77,17 @@ class Rect_Evaluator(Evaluator): def merge_mask_helper(self): new_eval_points = np.arange(len(self.eval_points)) - mask = self.mask + mask = self.mask.copy() for nc, ev_points in zip(new_eval_points, self.eval_points): - maske_low = np.min(ev_points) >= self.mask - maske_high = np.max(ev_points) <= self.mask - mask[np.logical_and(maske_high, maske_low)] = nc + maske_low = np.min(ev_points) <= self.mask + maske_high = np.max(ev_points) >= self.mask + maske = np.logical_and(maske_high, maske_low) + print("Debug: ", np.sum(maske)) + mask[maske] = nc + plt.figure() + plt.imshow(mask) + plt.show() + return mask def gen_mask_helper(self, img: FFT):