From f84c176f5317a4f85e8c2be6b6b38ab686d0ecba Mon Sep 17 00:00:00 2001 From: Aaddrick Date: Fri, 26 Apr 2024 06:59:32 -0400 Subject: [PATCH 1/2] Update FocusStack.py Updated OpenCV calls for SIFT and ORB. Updated print statement format. --- FocusStack.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/FocusStack.py b/FocusStack.py index 36ec099..a49e26f 100644 --- a/FocusStack.py +++ b/FocusStack.py @@ -64,18 +64,18 @@ def align_images(images): outimages = [] if use_sift: - detector = cv2.xfeatures2d.SIFT_create() + detector = cv2.SIFT.create() else: - detector = cv2.ORB_create(1000) + detector = cv2.ORB.create(1000) # We assume that image 0 is the "base" image and align everything to it - print "Detecting features of base image" + print("Detecting features of base image") outimages.append(images[0]) image1gray = cv2.cvtColor(images[0],cv2.COLOR_BGR2GRAY) image_1_kp, image_1_desc = detector.detectAndCompute(image1gray, None) for i in range(1,len(images)): - print "Aligning image {}".format(i) + print("Aligning image {}".format(i)) image_i_kp, image_i_desc = detector.detectAndCompute(images[i], None) if use_sift: @@ -126,14 +126,14 @@ def doLap(image): def focus_stack(unimages): images = align_images(unimages) - print "Computing the laplacian of the blurred images" + print("Computing the laplacian of the blurred images") laps = [] for i in range(len(images)): - print "Lap {}".format(i) + print("Lap {}".format(i)) laps.append(doLap(cv2.cvtColor(images[i],cv2.COLOR_BGR2GRAY))) laps = np.asarray(laps) - print "Shape of array of laplacians = {}".format(laps.shape) + print("Shape of array of laplacians = {}".format(laps.shape)) output = np.zeros(shape=images[0].shape, dtype=images[0].dtype) @@ -144,4 +144,4 @@ def focus_stack(unimages): for i in range(0,len(images)): output = cv2.bitwise_not(images[i],output, mask=mask[i]) - return 255-output \ No newline at end of file + return 255-output From 7b9b799a82d4d9c75d72e56d3b9dc994596b9c73 Mon Sep 17 00:00:00 2001 From: Aaddrick Date: Fri, 26 Apr 2024 07:00:23 -0400 Subject: [PATCH 2/2] Update main.py Updated print statement format --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 88d5202..1f4f3fa 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ def stackHDRs(image_files): focusimages = [] for img in image_files: - print "Reading in file {}".format(img) + print("Reading in file {}".format(img)) focusimages.append(cv2.imread("input/{}".format(img))) merged = FocusStack.focus_stack(focusimages) @@ -34,4 +34,4 @@ def stackHDRs(image_files): stackHDRs(image_files) - print "That's All Folks!" + print("That's All Folks!")