-
Notifications
You must be signed in to change notification settings - Fork 1
/
gui.py
217 lines (187 loc) · 9.18 KB
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
############################################################################
# This work, "Plenoptic Data Rendering", is a derivative of "4D Light #
# Field Benchmark" by Katrin Honauer & Ole Johannsen used under #
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International #
# License (http://creativecommons.org/licenses/by-nc-sa/4.0/) #
# and #
# "Stanford PLY Format" by Bruce Merry & Campbell Barton used under #
# GNU General Public License version 3.0 (GPLv3) #
# (https://www.gnu.org/licenses/gpl-3.0.html) / Desaturated from original #
# #
# "Plenoptic Data Rendering" is licensed under GPLv3 #
# (https://www.gnu.org/licenses/gpl-3.0.html) by Daniel Albares Martin #
# #
############################################################################
############################################################################
# This file is part of the 4D Light Field Benchmark. #
# #
# This work is licensed under the Creative Commons #
# Attribution-NonCommercial-ShareAlike 4.0 International License. #
# To view a copy of this license, #
# visit http://creativecommons.org/licenses/by-nc-sa/4.0/. #
# #
# Authors: Katrin Honauer & Ole Johannsen #
# Contact: contact@lightfield-analysis.net #
# Website: www.lightfield-analysis.net #
# #
# This add-on is based upon work of Maximilian Diebold #
# #
# The 4D Light Field Benchmark was jointly created by the University of #
# Konstanz and the HCI at Heidelberg University. If you use any part of #
# the benchmark, please cite our paper "A dataset and evaluation #
# methodology for depth estimation on 4D light fields". Thanks! #
# #
# @inproceedings{honauer2016benchmark, #
# title={A dataset and evaluation methodology for depth estimation on #
# 4D light fields}, #
# author={Honauer, Katrin and Johannsen, Ole and Kondermann, Daniel #
# and Goldluecke, Bastian}, #
# booktitle={Asian Conference on Computer Vision}, #
# year={2016}, #
# organization={Springer} #
# } #
# #
############################################################################
import bpy
from bpy.props import *
class VIEW3D_PT_camera_setup(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "objectmode"
bl_label = "Camera Set Up"
bl_category = "Plenoptic Data Rendering"
def draw(self, context):
LF = bpy.context.scene.LF
layout = self.layout
box = layout.box()
col = box.column(align=False)
col.operator("scene.create_lightfield", text="Add Camera Grid", icon="ADD")
col.operator("scene.delete_lightfield", text="Delete Camera Grid", icon="REMOVE")
box = layout.box()
col = box.column(align=True)
col.label(text="Number of cameras & position")
row = box.row()
col = box.column(align=True)
row.prop(LF, "num_cams_x", text="X:")
row.prop(LF, "num_cams_y", text="Y: ")
col.prop(LF, "baseline_mm")
col = box.column(align=True)
if LF.show_one_camera == False:
col.operator("scene.hide_cameras", text="Show only center camera", icon="HAND")
else:
col.operator("scene.show_cameras", text="Show all cameras", icon="HAND")
box = layout.box()
box.label(text="Camera parameters")
col = box.column(align=True)
col.prop(LF, "focus_dist")
col.prop(LF, "fstop")
col.prop(LF, "focal_length")
col.prop(LF, "sensor_size")
box.label(text="Resolution [px]")
row = box.row()
col = box.column(align=True)
row.prop(LF, "x_res")
row.prop(LF, "y_res")
box = layout.box()
box.label(text="Disparity preview")
col = box.column(align=True)
col.prop(LF, "frustum_min_disp")
col.prop(LF, "frustum_max_disp")
frustum_name = bpy.context.scene.LF.get_frustum_name()
if bpy.data.objects[frustum_name].hide_viewport == True:
col.operator("scene.show_frustum", text="Show Frustum", icon="HAND")
else:
col.operator("scene.hide_frustum", text="Hide Frustum", icon="HAND")
box = layout.box()
box.label(text="Save settings")
col = box.column(align=True)
col.prop(LF, "depth_map_scale")
col.prop(LF, "sequence_start")
col.prop(LF, "sequence_end")
col.prop(LF, "sequence_steps")
class VIEW3D_PT_render_setup(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "objectmode"
bl_label = "Rendering"
bl_category = "Plenoptic Data Rendering"
def draw(self, context):
LF = bpy.context.scene.LF
layout = self.layout
box = layout.box()
col = box.column(align=True)
col.prop(LF, "tgt_dir")
box = layout.box()
box.label(text="Light Field")
col = box.column(align=True)
col.label(text="Save images as:")
row = box.row(align=True)
col = box.column(align=True)
row.prop(LF, "save_lenslet_image", text="Lenslet")
row.prop(LF, "save_sidebyside_image", text="Side-by-side")
col.label(text="Save depth and disparity maps as:")
row = box.row(align=True)
col = box.column(align=True)
row.prop(LF, "save_depth_as_png", text="PNG")
row.prop(LF, "save_depth_as_pfm", text="PFM")
row = box.row(align=True)
col.prop(LF, "save_depth_for_all_views")
col.prop(LF, "save_object_id_maps_for_all_views")
col = box.column(align=True)
col.prop(LF, "focus_separation")
col.prop(LF, "focus_steps")
focus_planes_name = bpy.context.scene.LF.get_focus_planes_name()
if bpy.data.objects[focus_planes_name].hide_viewport == True:
col.operator("scene.show_focus_planes", text="Show focus range", icon="HAND")
else:
col.operator("scene.hide_focus_planes", text="Hide focus range", icon="HAND")
col = box.column(align=True)
col.label(text="Render Light Field as:")
col.operator("scene.render_lightfield", text="Multiple views", icon="OUTLINER_DATA_CAMERA")
col = box.column(align=True)
col.operator("scene.render_focus_stack", text="Focus stack", icon="NODE_COMPOSITING")
box = layout.box()
box.label(text="Point Cloud")
col = box.column(align=True)
col.prop(LF, "point_cloud_name")
col = box.column(align=True)
col.label(text="Render Point Cloud:")
col.operator("scene.render_pointcloud", text="From generated views", icon="OUTLINER_OB_POINTCLOUD")
col = box.column(align=True)
col.operator("export_mesh.ply", text="Directly from Blender", icon="OUTLINER_OB_POINTCLOUD")
class VIEW3D_PT_scene_settings(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "objectmode"
bl_label = "Scene Settings"
bl_category = "Plenoptic Data Rendering"
def draw(self, context):
LF = bpy.context.scene.LF
layout = self.layout
box = layout.box()
box.label(text="Information")
col = box.column(align=False)
col.prop(LF, "scene")
col.prop(LF, "date")
col.prop(LF, "authors")
box = layout.box()
box.label(text="Save/load settings")
col = box.column(align=False)
col.prop(LF, "path_config_file")
col.operator("scene.load_lightfield", text="Load config file", icon="SCENE_DATA")
col.operator("scene.save_lightfield", text="Save config file", icon="SCENE_DATA")
classes = (
VIEW3D_PT_camera_setup,
VIEW3D_PT_render_setup,
VIEW3D_PT_scene_settings,
)
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
if __name__ == "__main__":
register()