diff --git a/scripts/GUI.py b/scripts/GUI.py index 8c860cd5a03ef46138bde8dcffb0d96c2bad1eba..bf8aecdd96476f2eee85522eb57d51f846253f8f 100644 --- a/scripts/GUI.py +++ b/scripts/GUI.py @@ -41,8 +41,24 @@ def select_Image(event): label.configure(text="Image is selected. Press run to create scene.") def depthmap_creation(): - print("Checked ", check.get()) - + print("Manually upload depth map: ", uploadDepthCheck.get()) + + if uploadDepthCheck.get() == 1: # if manually upload checked + check.set(0) # disable auto generation of depth map + upload_depth_path = tkinter.filedialog.askopenfilename(title="Select a depth map", filetypes=[("PNG files", "*.png")]) #dialog box to upload depth map + + if upload_depth_path: + print(f"Uploaded depth map: {upload_depth_path}") + #TODO implement Mona's monodepth upload + else: + print("No depth map selected") + check.set(1) # if no depth map selected, enable auto generation of depth map + depth_check.deselect() # uncheck the depth map check box + else: + check.set(1) # if manually upload unchecked, enable auto generation of depth map + upload_depth_path = None + print("Removed uploaded depth map") + def stanfordRoom_selection(): if checkStanford.get() == 1: global stanford_frame @@ -87,6 +103,12 @@ def runProcess(): print(f"Attempting to run: {combined_bat}") print(f"With arguments: {file_path}, {str(check.get())}, {include_top_option}, {shift_image_option}") + # depth map check + if check.get() == 1: + print("Auto depth map") + else: + print("Manual depth map") + p = subprocess.Popen( [combined_bat, file_path, str(check.get()), include_top_option, shift_image_option], stdout=sys.stdout) @@ -125,7 +147,11 @@ def threading(): window = tk.Tk() window.title("Immersive VR scene creator") + check = tk.IntVar() +check.set(1) #automatically generate depth map as default +uploadDepthCheck = tk.IntVar() # added uploadDepthCheck vaiable: 0 = automatically upload depth map, 1 = manually upload depth map + checkStanford = tk.IntVar() include_top = tk.IntVar() shift_image = tk.IntVar() @@ -152,7 +178,7 @@ run_button = tk.Button( bg="green", fg="white", ) -depth_check = tk.Checkbutton(window, text='Create a depth map(360 MonoDepth)',variable=check, onvalue=1, offvalue=0, command=depthmap_creation) +depth_check = tk.Checkbutton(window, text='Upload a depth map(360 MonoDepth)',variable=uploadDepthCheck, onvalue=1, offvalue=0, command=depthmap_creation) stanford_check = tk.Checkbutton(window, text='Run for stanford2D3D dataset',variable=checkStanford, onvalue=1, offvalue=0,command=stanfordRoom_selection ) include_top_check = tk.Checkbutton(window, text='Include Top in Mesh', variable=include_top, onvalue=1, offvalue=0) shift_image_check = tk.Checkbutton(window, text='Shift input image', variable=shift_image, onvalue=1, offvalue=0, command=shift_image_selection)