From d99043ca6b8433759d8c55ad2f2a950e2fe16f05 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 7 Jul 2022 03:21:12 -0400 Subject: [PATCH] Better resize interpolation --- opendm/multispectral.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/opendm/multispectral.py b/opendm/multispectral.py index 14f5fe25..bc541780 100644 --- a/opendm/multispectral.py +++ b/opendm/multispectral.py @@ -423,10 +423,15 @@ def find_ecc_homography(image_gray, align_image_gray, number_of_iterations=1000, if align_image_gray.shape[0] != image_gray.shape[0]: align_image_gray = to_8bit(align_image_gray) image_gray = to_8bit(image_gray) + + interpolation_mode = cv2.INTER_CUBIC + if image_gray.shape[0] < align_image_gray.shape[0] and image_gray.shape[1] < align_image_gray.shape[1]: + interpolation_mode = cv2.INTER_AREA + image_gray = cv2.resize(image_gray, None, fx=align_image_gray.shape[1]/image_gray.shape[1], fy=align_image_gray.shape[0]/image_gray.shape[0], - interpolation=cv2.INTER_AREA) + interpolation=interpolation_mode) # Build pyramids image_gray_pyr = [image_gray]