From ccf63650f663e87c8b8f8afd941d389fa1567ec7 Mon Sep 17 00:00:00 2001 From: Bruno Madeira Date: Sat, 24 Aug 2024 23:50:55 +0100 Subject: [PATCH] remove prints & tests from "guess block size" related scripts. --- guess_block_size.py | 21 --------------------- misc/bse_desc_util.py | 8 -------- misc/bse_ft_util.py | 8 -------- 3 files changed, 37 deletions(-) diff --git a/guess_block_size.py b/guess_block_size.py index 4cea2db..90872bc 100644 --- a/guess_block_size.py +++ b/guess_block_size.py @@ -112,8 +112,6 @@ def guess_nice_block_size(src: np.ndarray, freq_analysis_only: bool = False, desc_analysis_pairs = [] if freq_analysis_only else analyze_keypoint_scales(src) # all pairs should come already sorted in descending order w/ respect to weight - print(freq_analysis_pairs) - print(desc_analysis_pairs) # filter very small distances, with respect to the src size min_dim = min(src.shape[:2]) @@ -133,23 +131,4 @@ def guess_nice_block_size(src: np.ndarray, freq_analysis_only: bool = False, *normalize_weights(desc_analysis_pairs) ] # may contain duplicates or multiples, that is expected - print(f"final pairs: {final_pairs}") return make_guess(final_pairs, min_dim, max_block_size) - - -if __name__ == "__main__": - from cv2 import imread, IMREAD_GRAYSCALE - - image_path = "t9.png" - image = imread(image_path, IMREAD_GRAYSCALE) - block_size = guess_nice_block_size(image, freq_analysis_only=False) - print(f"guessed block_size = {block_size}") - # prev values - # t9 -> 64 - # t16 -> 55 - # t18 -> 82 - # new values (freq_only=false, true) - # t9 -> 64, 64 - # t16 -> 44, 44 - # t18 -> 48, 42 - # t166 -> 99, 88 (fixed!) diff --git a/misc/bse_desc_util.py b/misc/bse_desc_util.py index 874294b..2af1f7a 100644 --- a/misc/bse_desc_util.py +++ b/misc/bse_desc_util.py @@ -105,12 +105,4 @@ def analyze_keypoint_scales(image: np.ndarray) -> size_weight_pairs: dist_weight_pairs.extend([(round(distance_pairs[i]), pairs_areas[i] * label_counts[i]) for i, _ in enumerate(labels_coverage)]) dist_weight_pairs.sort(key=lambda i: i[1], reverse=True) - print(f"sorted descs = {dist_weight_pairs}") return dist_weight_pairs - - -if __name__ == "__main__": - image_path = '../t9.png' - image = cv2.imread(image_path) - data = analyze_keypoint_scales(image) - print(data) diff --git a/misc/bse_ft_util.py b/misc/bse_ft_util.py index d581166..ce1484d 100644 --- a/misc/bse_ft_util.py +++ b/misc/bse_ft_util.py @@ -53,12 +53,4 @@ def compute_wavelens_of_interest(spectrum: np.ndarray, max_to_fetch: int = 16) - def analyze_freq_spectrum(image: np.ndarray, max_items: int = 16) -> size_weight_pairs: magnitude_spectrum = compute_fft(image) wlen_mag_pairs = compute_wavelens_of_interest(magnitude_spectrum, max_items) - print(f"sorted wavelens = {wlen_mag_pairs}") return wlen_mag_pairs - - -if __name__ == "__main__": - image_path = "../t16.png" - image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE) - data = analyze_freq_spectrum(image) - print(data)