Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
6369d5ab
Commit
6369d5ab
authored
7 years ago
by
Luise Odenthal
Browse files
Options
Downloads
Patches
Plain Diff
setter in rendering updated
parent
bfb0bbe2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
navipy/rendering/bee_sampling.py~
+1
-1
1 addition, 1 deletion
navipy/rendering/bee_sampling.py~
navipy/rendering/cyber_bee.py
+23
-34
23 additions, 34 deletions
navipy/rendering/cyber_bee.py
navipy/rendering/cyber_bee.py~
+22
-34
22 additions, 34 deletions
navipy/rendering/cyber_bee.py~
with
46 additions
and
69 deletions
navipy/rendering/bee_sampling.py~
+
1
−
1
View file @
6369d5ab
...
...
@@ -159,6 +159,6 @@ if __name__ == "__main__":
grid_pos = bee_samp.grid_posorients
condition = (grid_pos.x**2 + grid_pos.y**2) < ((bee_samp.world_dim / 2)**2)
bee_samp.set_gridindeces2nan(condition[condition == 0].index)
bee_samp.
set_
cycle_samples(samples=5)
bee_samp.cycle_samples(samples=5)
with tempfile.TemporaryDirectory() as folder:
bee_samp.render(folder + '/database.db')
This diff is collapsed.
Click to expand it.
navipy/rendering/cyber_bee.py
+
23
−
34
View file @
6369d5ab
...
...
@@ -48,9 +48,9 @@ class Cyberbee():
bpy
.
context
.
scene
.
cycles
.
filter_type
=
'
GAUSSIAN
'
# Call all set function with default values
self
.
camera_rotation_mode
=
'
XYZ
'
self
.
camera_fov
()
self
.
camera_fov
=
[[
-
90
,
90
],
[
-
180
,
180
]]
self
.
camera_gaussian_width
=
1.5
self
.
camera_resolution
()
self
.
camera_resolution
=
[
360
,
180
]
self
.
cycle_samples
=
30
# switch on nodes
# Create render link to OutputFile with Image and Z buffer
...
...
@@ -183,19 +183,14 @@ class Cyberbee():
self
.
camera
.
data
.
cycles
.
longitude_max
)
return
fov
# @camera_fov.setter
def
set_camera_fov
(
self
,
latmin
=-
90
,
latmax
=+
90
,
longmin
=-
180
,
longmax
=+
180
):
@camera_fov.setter
def
camera_fov
(
self
,
resolution
=
[[
-
90
,
90
],
[
-
180
,
180
]]):
"""
change the field of view of the panoramic camera
:param latmin: minimum latitude (in deg)
:type latmin: float
:param latmax: maximum latitude (in deg)
:type latmax: float
:param longmin: minimum longitude (in deg)
:type longmin: float
:param longmin: maximum longitude (in deg)
:type longmin: float
:param resolution: [[minimum latitude, maximum latitude],
[minimum longitude, maximum longitude]]
(in deg)
:type latmin: 2x2 float array or list
..todo use @property.setter
def camera_fov(self, latlongrange)
...
...
@@ -204,22 +199,17 @@ class Cyberbee():
..todo Change assert to if -> raise TypeError()/KeyError()
"""
if
not
(
isinstance
(
latmin
,
int
)
or
isinstance
(
latmin
,
float
)):
raise
TypeError
(
'
latmin must be of type integer or float
'
)
if
not
(
isinstance
(
latmax
,
int
)
or
isinstance
(
latmax
,
float
)):
raise
TypeError
(
'
latmin must be of type integer or float
'
)
if
not
(
isinstance
(
longmin
,
int
)
or
isinstance
(
longmin
,
float
)):
raise
TypeError
(
'
latmin must be of type integer or float
'
)
if
not
(
isinstance
(
longmax
,
int
)
or
isinstance
(
longmax
,
float
)):
raise
TypeError
(
'
latmin must be of type integer or float
'
)
if
not
(
isinstance
(
resolution
,
list
)
or
isinstance
(
resolution
,
np
.
ndarray
)):
raise
TypeError
(
'
resolution must be list or array
'
)
if
not
self
.
camera
.
data
.
type
==
'
PANO
'
:
raise
Exception
(
'
Camera is not panoramic
'
)
if
not
self
.
camera
.
data
.
cycles
.
panorama_type
==
'
EQUIRECTANGULAR
'
:
raise
Exception
(
'
Camera is not equirectangular
'
)
self
.
camera
.
data
.
cycles
.
latitude_min
=
np
.
deg2rad
(
latmin
)
self
.
camera
.
data
.
cycles
.
latitude_max
=
np
.
deg2rad
(
latmax
)
self
.
camera
.
data
.
cycles
.
longitude_min
=
np
.
deg2rad
(
longmin
)
self
.
camera
.
data
.
cycles
.
longitude_max
=
np
.
deg2rad
(
longmax
)
self
.
camera
.
data
.
cycles
.
latitude_min
=
np
.
deg2rad
(
resolution
[
0
,
0
]
)
self
.
camera
.
data
.
cycles
.
latitude_max
=
np
.
deg2rad
(
resolution
[
0
,
1
]
)
self
.
camera
.
data
.
cycles
.
longitude_min
=
np
.
deg2rad
(
resolution
[
1
,
0
]
)
self
.
camera
.
data
.
cycles
.
longitude_max
=
np
.
deg2rad
(
resolution
[
1
,
1
]
)
@property
def
camera_gaussian_width
(
self
,
gauss_w
=
1.5
):
...
...
@@ -269,8 +259,8 @@ class Cyberbee():
resolution_y
=
bpy
.
context
.
scene
.
render
.
resolution_y
return
resolution_x
,
resolution_y
#
@camera_resolution.setter
def
set_camera_resolution
(
self
,
resolution
_x
=
360
,
resolution_y
=
180
):
@camera_resolution.setter
def
set_camera_resolution
(
self
,
resolution
=
[
360
,
180
]
):
"""
change the camera resolution (nb of pixels)
...
...
@@ -293,18 +283,17 @@ class Cyberbee():
..todo check type and raise TypeError
"""
if
not
isinstance
(
resolution_x
,
int
):
raise
TypeError
(
'
resolution must be integer
'
)
if
not
isinstance
(
resolution_y
,
int
):
raise
TypeError
(
'
resolution must be integer
'
)
bpy
.
context
.
scene
.
render
.
resolution_x
=
resolution_x
bpy
.
context
.
scene
.
render
.
resolution_y
=
resolution_y
if
not
(
isinstance
(
resolution
,
list
)
or
isinstance
(
resolution
,
np
.
ndarray
)):
raise
TypeError
(
'
resolution list or array
'
)
bpy
.
context
.
scene
.
render
.
resolution_x
=
resolution
[
0
]
bpy
.
context
.
scene
.
render
.
resolution_y
=
resolution
[
1
]
bpy
.
context
.
scene
.
render
.
resolution_percentage
=
100
def
update
(
self
,
posorient
):
"""
assign the position and the orientation of the camera.
:param posorient: is a 1x6 vector contin
a
ing:
:param posorient: is a 1x6 vector cont
a
ining:
x,y,z, angle_1, angle_2, angle_3,
here the angles are euler rotation around the axis
specified by scene.camera.rotation_mode
...
...
This diff is collapsed.
Click to expand it.
navipy/rendering/cyber_bee.py~
+
22
−
34
View file @
6369d5ab
...
...
@@ -48,9 +48,9 @@ class Cyberbee():
bpy.context.scene.cycles.filter_type = 'GAUSSIAN'
# Call all set function with default values
self.camera_rotation_mode = 'XYZ'
self.camera_fov
()
self.camera_fov
= [[-90, 90], [-180, 180]]
self.camera_gaussian_width = 1.5
self.camera_resolution
()
self.camera_resolution
= [360, 180]
self.cycle_samples = 30
# switch on nodes
# Create render link to OutputFile with Image and Z buffer
...
...
@@ -183,19 +183,14 @@ class Cyberbee():
self.camera.data.cycles.longitude_max)
return fov
# @camera_fov.setter
def set_camera_fov(self, latmin=-90, latmax=+90,
longmin=-180, longmax=+180):
@camera_fov.setter
def camera_fov(self, resolution=[[-90, 90], [-180, 180]]):
"""change the field of view of the panoramic camera
:param latmin: minimum latitude (in deg)
:type latmin: float
:param latmax: maximum latitude (in deg)
:type latmax: float
:param longmin: minimum longitude (in deg)
:type longmin: float
:param longmin: maximum longitude (in deg)
:type longmin: float
:param resolution: [[minimum latitude, maximum latitude],
[minimum longitude, maximum longitude]]
(in deg)
:type latmin: 2x2 float array or list
..todo use @property.setter
def camera_fov(self, latlongrange)
...
...
@@ -204,22 +199,17 @@ class Cyberbee():
..todo Change assert to if -> raise TypeError()/KeyError()
"""
if not (isinstance(latmin, int) or isinstance(latmin, float)):
raise TypeError('latmin must be of type integer or float')
if not (isinstance(latmax, int) or isinstance(latmax, float)):
raise TypeError('latmin must be of type integer or float')
if not (isinstance(longmin, int) or isinstance(longmin, float)):
raise TypeError('latmin must be of type integer or float')
if not (isinstance(longmax, int) or isinstance(longmax, float)):
raise TypeError('latmin must be of type integer or float')
if not (isinstance(resolution, list) or
isinstance(resolution, np.ndarray)):
raise TypeError('resolution must be list or array')
if not self.camera.data.type == 'PANO':
raise Exception('Camera is not panoramic')
if not self.camera.data.cycles.panorama_type == 'EQUIRECTANGULAR':
raise Exception('Camera is not equirectangular')
self.camera.data.cycles.latitude_min = np.deg2rad(
latmin
)
self.camera.data.cycles.latitude_max = np.deg2rad(
latmax
)
self.camera.data.cycles.longitude_min = np.deg2rad(
longmin
)
self.camera.data.cycles.longitude_max = np.deg2rad(
longmax
)
self.camera.data.cycles.latitude_min = np.deg2rad(
resolution[0, 0]
)
self.camera.data.cycles.latitude_max = np.deg2rad(
resolution[0, 1]
)
self.camera.data.cycles.longitude_min = np.deg2rad(
resolution[1, 0]
)
self.camera.data.cycles.longitude_max = np.deg2rad(
resolution[1, 1]
)
@property
def camera_gaussian_width(self, gauss_w=1.5):
...
...
@@ -269,8 +259,8 @@ class Cyberbee():
resolution_y = bpy.context.scene.render.resolution_y
return resolution_x, resolution_y
#
@camera_resolution.setter
def set_camera_resolution(self, resolution
_x
=360,
resolution_y=
180):
@camera_resolution.setter
def set_camera_resolution(self, resolution=
[
360, 180
]
):
"""change the camera resolution (nb of pixels)
...
...
@@ -293,18 +283,16 @@ class Cyberbee():
..todo check type and raise TypeError
"""
if not isinstance(resolution_x, int):
raise TypeError('resolution must be integer')
if not isinstance(resolution_y, int):
raise TypeError('resolution must be integer')
bpy.context.scene.render.resolution_x = resolution_x
bpy.context.scene.render.resolution_y = resolution_y
if not (isinstance(resolution, list) or isinstance(resolution, np.ndarray)):
raise TypeError('resolution list or array')
bpy.context.scene.render.resolution_x = resolution[0]
bpy.context.scene.render.resolution_y = resolution[1]
bpy.context.scene.render.resolution_percentage = 100
def update(self, posorient):
"""assign the position and the orientation of the camera.
:param posorient: is a 1x6 vector contin
a
ing:
:param posorient: is a 1x6 vector cont
a
ining:
x,y,z, angle_1, angle_2, angle_3,
here the angles are euler rotation around the axis
specified by scene.camera.rotation_mode
...
...
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