Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AVVR-Pipeline-GDP4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP Project 4
AVVR-Pipeline-GDP4
Commits
3b7b282b
Commit
3b7b282b
authored
8 months ago
by
mhby1g21
Browse files
Options
Downloads
Patches
Plain Diff
renamed old GUI to old_GUI.py and created new GUI.py
parent
7445f3ae
No related branches found
No related tags found
1 merge request
!7
4.3.1 - Redesign GUI and remove .bat dependencies and GDP 4.3.3 - Delete Temporary Files On Main Pipeline Run on new GUI.py
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/GUI.py
+0
-196
0 additions, 196 deletions
scripts/GUI.py
scripts/old_GUI.py
+196
-0
196 additions, 0 deletions
scripts/old_GUI.py
with
196 additions
and
196 deletions
scripts/GUI.py
+
0
−
196
View file @
3b7b282b
import
tkinter
as
tk
import
tkinter.filedialog
import
subprocess
import
sys
import
time
from
threading
import
Thread
import
shutil
import
os
# Get the directory of the current script
SCRIPT_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# Get the root directory (AVVR-Pipeline-Internship)
ROOT_DIR
=
os
.
path
.
dirname
(
SCRIPT_DIR
)
file_path
=
None
createDepth
=
"
0
"
def
shift_image_selection
():
# This function can be used if you want to perform any action when the checkbox is clicked
pass
def
copy_intermediary_outputs
():
source_folder
=
os
.
path
.
join
(
ROOT_DIR
,
"
edgenet-360
"
,
"
Data
"
,
"
Input
"
)
destination_folder
=
os
.
path
.
join
(
ROOT_DIR
,
"
edgenet-360
"
,
"
Output
"
)
files_to_copy
=
[
"
depth_e.png
"
,
"
enhanced_depth_e.png
"
,
"
material.png
"
,
"
rgb.png
"
]
for
file_name
in
files_to_copy
:
source_path
=
os
.
path
.
join
(
source_folder
,
file_name
)
destination_path
=
os
.
path
.
join
(
destination_folder
,
file_name
)
try
:
shutil
.
copy
(
source_path
,
destination_path
)
print
(
f
"
Copied
{
file_name
}
to
{
destination_folder
}
"
)
except
FileNotFoundError
:
print
(
f
"
Warning:
{
file_name
}
not found in
{
source_folder
}
"
)
def
select_Image
(
event
):
global
file_path
file_path
=
tkinter
.
filedialog
.
askopenfilename
()
file_path
=
os
.
path
.
normpath
(
file_path
)
select_button
.
configure
(
text
=
"
Selected
"
,
bg
=
"
red
"
)
label
.
configure
(
text
=
"
Image is selected. Press run to create scene.
"
)
def
depthmap_creation
():
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
stanford_frame
=
tk
.
Frame
(
window
)
stanford_frame
.
pack
(
fill
=
tk
.
X
,
padx
=
5
,
pady
=
5
)
global
labelRoomArea
labelRoomArea
=
tk
.
Label
(
stanford_frame
,
text
=
"
Please Input Room Area:
"
)
labelRoomArea
.
pack
(
side
=
"
left
"
)
global
stanford_text
stanford_text
=
tk
.
Entry
(
stanford_frame
)
stanford_text
.
pack
(
side
=
"
left
"
,
fill
=
tk
.
X
,
expand
=
True
)
else
:
stanford_frame
.
pack_forget
()
select_button
.
pack
(
side
=
"
top
"
,
fill
=
tk
.
X
,
expand
=
True
,
padx
=
5
,
pady
=
5
)
run_button
.
pack
(
side
=
"
top
"
,
fill
=
tk
.
X
,
expand
=
True
,
padx
=
5
,
pady
=
5
)
def
run_Image
(
event
):
if
checkStanford
.
get
()
==
0
:
label
.
configure
(
text
=
"
Pipeline is running. Creating scene...
"
,
height
=
15
)
else
:
label
.
configure
(
text
=
"
Pipeline is running for Stanford2D3D dataset. Creating scene...
"
,
height
=
15
)
labelRoomArea
.
configure
(
text
=
"
Room Area Running :
"
)
stanford_text
.
configure
(
state
=
"
disabled
"
)
select_button
.
pack_forget
()
run_button
.
pack_forget
()
depth_check
.
pack_forget
()
include_top_check
.
pack_forget
()
stanford_check
.
pack_forget
()
shift_image_check
.
pack_forget
()
threading
()
def
runProcess
():
global
file_path
include_top_option
=
"
y
"
if
include_top
.
get
()
==
1
else
""
shift_image_option
=
"
y
"
if
shift_image
.
get
()
==
1
else
""
try
:
if
checkStanford
.
get
()
==
0
:
combined_bat
=
os
.
path
.
join
(
SCRIPT_DIR
,
"
combined.bat
"
)
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
)
p
.
communicate
()
else
:
temp
=
os
.
path
.
split
(
file_path
)
suffices
=
temp
[
-
1
].
split
(
"
_
"
)
camera_pos
=
str
(
suffices
[
1
])
room_name
=
suffices
[
2
]
+
"
_
"
+
suffices
[
3
]
room_area
=
stanford_text
.
get
()
print
(
room_area
,
room_name
,
camera_pos
)
combined_stanford_bat
=
os
.
path
.
join
(
SCRIPT_DIR
,
"
combined_stanford.bat
"
)
p
=
subprocess
.
Popen
(
[
combined_stanford_bat
,
file_path
,
camera_pos
,
str
(
room_area
),
room_name
],
stdout
=
sys
.
stdout
)
p
.
communicate
()
copy_intermediary_outputs
()
label
.
configure
(
text
=
"
Pipeline execution complete, check output folder.
"
)
except
Exception
as
e
:
print
(
f
"
An error occurred:
{
e
}
"
)
label
.
configure
(
text
=
f
"
An error occurred:
{
e
}
"
)
try
:
labelRoomArea
.
pack_forget
()
stanford_text
.
pack_forget
()
except
Exception
as
e
:
print
(
e
)
def
threading
():
thread1
=
Thread
(
target
=
runProcess
)
thread1
.
start
()
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
()
label
=
tk
.
Label
(
text
=
"
Please Input a RGB image for scene creation
"
,
foreground
=
"
black
"
,
background
=
"
white
"
,
width
=
50
,
height
=
10
,
)
select_button
=
tk
.
Button
(
text
=
"
Select
"
,
width
=
50
,
height
=
5
,
bg
=
"
green
"
,
fg
=
"
white
"
,
)
run_button
=
tk
.
Button
(
text
=
"
Run
"
,
width
=
50
,
height
=
5
,
bg
=
"
green
"
,
fg
=
"
white
"
,
)
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
)
label
.
pack
()
depth_check
.
pack
()
stanford_check
.
pack
()
include_top_check
.
pack
()
shift_image_check
.
pack
()
select_button
.
pack
()
run_button
.
pack
()
select_button
.
bind
(
'
<Button-1>
'
,
select_Image
)
run_button
.
bind
(
'
<Button-1>
'
,
run_Image
)
window
.
mainloop
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
scripts/old_GUI.py
0 → 100644
+
196
−
0
View file @
3b7b282b
import
tkinter
as
tk
import
tkinter.filedialog
import
subprocess
import
sys
import
time
from
threading
import
Thread
import
shutil
import
os
# Get the directory of the current script
SCRIPT_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# Get the root directory (AVVR-Pipeline-Internship)
ROOT_DIR
=
os
.
path
.
dirname
(
SCRIPT_DIR
)
file_path
=
None
createDepth
=
"
0
"
def
shift_image_selection
():
# This function can be used if you want to perform any action when the checkbox is clicked
pass
def
copy_intermediary_outputs
():
source_folder
=
os
.
path
.
join
(
ROOT_DIR
,
"
edgenet-360
"
,
"
Data
"
,
"
Input
"
)
destination_folder
=
os
.
path
.
join
(
ROOT_DIR
,
"
edgenet-360
"
,
"
Output
"
)
files_to_copy
=
[
"
depth_e.png
"
,
"
enhanced_depth_e.png
"
,
"
material.png
"
,
"
rgb.png
"
]
for
file_name
in
files_to_copy
:
source_path
=
os
.
path
.
join
(
source_folder
,
file_name
)
destination_path
=
os
.
path
.
join
(
destination_folder
,
file_name
)
try
:
shutil
.
copy
(
source_path
,
destination_path
)
print
(
f
"
Copied
{
file_name
}
to
{
destination_folder
}
"
)
except
FileNotFoundError
:
print
(
f
"
Warning:
{
file_name
}
not found in
{
source_folder
}
"
)
def
select_Image
(
event
):
global
file_path
file_path
=
tkinter
.
filedialog
.
askopenfilename
()
file_path
=
os
.
path
.
normpath
(
file_path
)
select_button
.
configure
(
text
=
"
Selected
"
,
bg
=
"
red
"
)
label
.
configure
(
text
=
"
Image is selected. Press run to create scene.
"
)
def
depthmap_creation
():
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
stanford_frame
=
tk
.
Frame
(
window
)
stanford_frame
.
pack
(
fill
=
tk
.
X
,
padx
=
5
,
pady
=
5
)
global
labelRoomArea
labelRoomArea
=
tk
.
Label
(
stanford_frame
,
text
=
"
Please Input Room Area:
"
)
labelRoomArea
.
pack
(
side
=
"
left
"
)
global
stanford_text
stanford_text
=
tk
.
Entry
(
stanford_frame
)
stanford_text
.
pack
(
side
=
"
left
"
,
fill
=
tk
.
X
,
expand
=
True
)
else
:
stanford_frame
.
pack_forget
()
select_button
.
pack
(
side
=
"
top
"
,
fill
=
tk
.
X
,
expand
=
True
,
padx
=
5
,
pady
=
5
)
run_button
.
pack
(
side
=
"
top
"
,
fill
=
tk
.
X
,
expand
=
True
,
padx
=
5
,
pady
=
5
)
def
run_Image
(
event
):
if
checkStanford
.
get
()
==
0
:
label
.
configure
(
text
=
"
Pipeline is running. Creating scene...
"
,
height
=
15
)
else
:
label
.
configure
(
text
=
"
Pipeline is running for Stanford2D3D dataset. Creating scene...
"
,
height
=
15
)
labelRoomArea
.
configure
(
text
=
"
Room Area Running :
"
)
stanford_text
.
configure
(
state
=
"
disabled
"
)
select_button
.
pack_forget
()
run_button
.
pack_forget
()
depth_check
.
pack_forget
()
include_top_check
.
pack_forget
()
stanford_check
.
pack_forget
()
shift_image_check
.
pack_forget
()
threading
()
def
runProcess
():
global
file_path
include_top_option
=
"
y
"
if
include_top
.
get
()
==
1
else
""
shift_image_option
=
"
y
"
if
shift_image
.
get
()
==
1
else
""
try
:
if
checkStanford
.
get
()
==
0
:
combined_bat
=
os
.
path
.
join
(
SCRIPT_DIR
,
"
combined.bat
"
)
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
)
p
.
communicate
()
else
:
temp
=
os
.
path
.
split
(
file_path
)
suffices
=
temp
[
-
1
].
split
(
"
_
"
)
camera_pos
=
str
(
suffices
[
1
])
room_name
=
suffices
[
2
]
+
"
_
"
+
suffices
[
3
]
room_area
=
stanford_text
.
get
()
print
(
room_area
,
room_name
,
camera_pos
)
combined_stanford_bat
=
os
.
path
.
join
(
SCRIPT_DIR
,
"
combined_stanford.bat
"
)
p
=
subprocess
.
Popen
(
[
combined_stanford_bat
,
file_path
,
camera_pos
,
str
(
room_area
),
room_name
],
stdout
=
sys
.
stdout
)
p
.
communicate
()
copy_intermediary_outputs
()
label
.
configure
(
text
=
"
Pipeline execution complete, check output folder.
"
)
except
Exception
as
e
:
print
(
f
"
An error occurred:
{
e
}
"
)
label
.
configure
(
text
=
f
"
An error occurred:
{
e
}
"
)
try
:
labelRoomArea
.
pack_forget
()
stanford_text
.
pack_forget
()
except
Exception
as
e
:
print
(
e
)
def
threading
():
thread1
=
Thread
(
target
=
runProcess
)
thread1
.
start
()
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
()
label
=
tk
.
Label
(
text
=
"
Please Input a RGB image for scene creation
"
,
foreground
=
"
black
"
,
background
=
"
white
"
,
width
=
50
,
height
=
10
,
)
select_button
=
tk
.
Button
(
text
=
"
Select
"
,
width
=
50
,
height
=
5
,
bg
=
"
green
"
,
fg
=
"
white
"
,
)
run_button
=
tk
.
Button
(
text
=
"
Run
"
,
width
=
50
,
height
=
5
,
bg
=
"
green
"
,
fg
=
"
white
"
,
)
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
)
label
.
pack
()
depth_check
.
pack
()
stanford_check
.
pack
()
include_top_check
.
pack
()
shift_image_check
.
pack
()
select_button
.
pack
()
run_button
.
pack
()
select_button
.
bind
(
'
<Button-1>
'
,
select_Image
)
run_button
.
bind
(
'
<Button-1>
'
,
run_Image
)
window
.
mainloop
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment