From aafd332c8c80622da7b0a6e1d0a31252069dc9cf Mon Sep 17 00:00:00 2001 From: Ng Chan Way Date: Thu, 19 Dec 2019 16:45:36 +0800 Subject: [PATCH 1/5] Update FocusStack.py Update `print` from Python2 to Python3 syntax --- FocusStack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FocusStack.py b/FocusStack.py index 36ec099..7b8e3ff 100644 --- a/FocusStack.py +++ b/FocusStack.py @@ -133,7 +133,7 @@ def focus_stack(unimages): 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 ef609429c6dfc309dd53596b458d53a1bd832b3e Mon Sep 17 00:00:00 2001 From: Ng Chan Way Date: Thu, 19 Dec 2019 16:51:19 +0800 Subject: [PATCH 2/5] Update FocusStack.py Update all `print` syntax to Python3 --- FocusStack.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FocusStack.py b/FocusStack.py index 7b8e3ff..059df32 100644 --- a/FocusStack.py +++ b/FocusStack.py @@ -69,13 +69,13 @@ def align_images(images): 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,10 +126,10 @@ 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) From 9f2c4bf6195e6023fae5fd3ce49ab78bb0328145 Mon Sep 17 00:00:00 2001 From: Ng Chan Way Date: Thu, 19 Dec 2019 16:53:13 +0800 Subject: [PATCH 3/5] Update main.py Update `print` syntax to Python3 --- 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!") From c36557942be5efc60c8319d74975c5df3703383f Mon Sep 17 00:00:00 2001 From: Ng Chan Way Date: Thu, 19 Dec 2019 16:57:50 +0800 Subject: [PATCH 4/5] Update main.py Fix a minor typo `Input` --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 1f4f3fa..642d50c 100644 --- a/main.py +++ b/main.py @@ -27,7 +27,7 @@ def stackHDRs(image_files): if __name__ == "__main__": - image_files = sorted(os.listdir("input")) + image_files = sorted(os.listdir("Input")) for img in image_files: if img.split(".")[-1].lower() not in ["jpg", "jpeg", "png"]: image_files.remove(img) From 15d0f880b9485a1c647c4bf7377f236815d835c7 Mon Sep 17 00:00:00 2001 From: Ng Chan Way Date: Thu, 19 Dec 2019 17:11:05 +0800 Subject: [PATCH 5/5] Update main.py Update all the typo `input` to `Input` --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 642d50c..69ebcb6 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ Focus stack driver program This program looks for a series of files of type .jpg, .jpeg, or .png - in a subdirectory "input" and then merges them together using the + in a subdirectory "Input" and then merges them together using the FocusStack module. The output is put in the file merged.png @@ -20,7 +20,7 @@ def stackHDRs(image_files): focusimages = [] for img in image_files: print("Reading in file {}".format(img)) - focusimages.append(cv2.imread("input/{}".format(img))) + focusimages.append(cv2.imread("Input/{}".format(img))) merged = FocusStack.focus_stack(focusimages) cv2.imwrite("merged.png", merged)