remove prints & tests from "guess block size" related scripts.
This commit is contained in:
@@ -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!)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user