Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
obj2rgbd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
obj2rgbd
Commits
8fe4b1aa
Commit
8fe4b1aa
authored
Feb 27, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test model
parent
c0fbf9a8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
0 deletions
+106
-0
blender_generate_image_and_depth.py
blender_generate_image_and_depth.py
+4
-0
test_cube.mtl
input/test_cube/test_cube.mtl
+12
-0
test_cube.obj
input/test_cube/test_cube.obj
+46
-0
open3d_test.py
open3d_test.py
+44
-0
No files found.
blender_generate_image_and_depth.py
View file @
8fe4b1aa
...
@@ -99,6 +99,10 @@ for fpath in fpaths:
...
@@ -99,6 +99,10 @@ for fpath in fpaths:
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
fpath
,
use_smooth_groups
=
False
)
bpy
.
ops
.
import_scene
.
obj
(
filepath
=
fpath
,
use_smooth_groups
=
False
)
for
o
in
bpy
.
data
.
objects
:
if
o
.
name
!=
"Camera"
:
obj_name
=
o
.
name
obj
=
bpy
.
data
.
objects
[
obj_name
]
obj
=
bpy
.
data
.
objects
[
obj_name
]
for
mat
in
obj
.
material_slots
:
for
mat
in
obj
.
material_slots
:
mat
.
material
.
use_nodes
=
True
mat
.
material
.
use_nodes
=
True
...
...
input/test_cube/test_cube.mtl
0 → 100644
View file @
8fe4b1aa
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.016913 0.040888 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.0 0.0 0.0
Ni 1.450000
d 1.000000
illum 2
input/test_cube/test_cube.obj
0 → 100644
View file @
8fe4b1aa
# Blender v2.80 (sub 75) OBJ File: ''
# www.blender.org
mtllib test_cube.mtl
o test_cube
v 0.000000 32.726936 -111.355507
v 0.000000 0.202909 -134.640411
v 28.284271 16.262016 -88.357544
v 28.284271 -16.262012 -111.642456
v -28.284271 16.262012 -88.357544
v -28.284271 -16.262016 -111.642456
v 0.000000 -0.202909 -65.359581
v 0.000000 -32.726936 -88.644493
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.375000 0.250000
vt 0.625000 0.250000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.125000 0.500000
vt 0.375000 0.500000
vt 0.375000 0.750000
vt 0.125000 0.750000
vt 0.625000 0.500000
vt 0.875000 0.500000
vt 0.875000 0.750000
vn -0.0000 0.8131 0.5821
vn 0.7071 -0.4116 0.5749
vn -0.7071 -0.4116 0.5749
vn 0.0000 -0.8131 -0.5821
vn 0.7071 0.4116 -0.5749
vn -0.7071 0.4116 -0.5749
usemtl Material
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/8/3 7/7/3 5/9/3 6/10/3
f 6/10/4 2/11/4 4/12/4 8/13/4
f 2/14/5 1/15/5 3/16/5 4/17/5
f 6/18/6 5/19/6 1/20/6 2/11/6
open3d_test.py
0 → 100644
View file @
8fe4b1aa
# From here: http://www.open3d.org/docs/release/tutorial/Basic/rgbd_images/redwood.html
# examples/Python/Basic/rgbd_redwood.py
import
open3d
as
o3d
import
matplotlib.pyplot
as
plt
import
sys
if
__name__
==
"__main__"
:
image_path
=
"output/test_cube-image.jpeg"
depth_path
=
"output/test_cube-depth-10cm.png"
try
:
image_path
=
sys
.
argv
[
1
]
depth_path
=
sys
.
argv
[
2
]
except
IndexError
:
pass
color_raw
=
o3d
.
io
.
read_image
(
image_path
)
depth_raw
=
o3d
.
io
.
read_image
(
depth_path
)
rgbd_image
=
o3d
.
geometry
.
RGBDImage
.
create_from_color_and_depth
(
color_raw
,
depth_raw
)
print
(
rgbd_image
)
plt
.
subplot
(
1
,
2
,
1
)
plt
.
title
(
'Grayscale image'
)
plt
.
imshow
(
rgbd_image
.
color
)
plt
.
subplot
(
1
,
2
,
2
)
plt
.
title
(
'Depth image'
)
plt
.
imshow
(
rgbd_image
.
depth
)
plt
.
show
()
psd
=
o3d
.
camera
.
PinholeCameraIntrinsicParameters
.
PrimeSenseDefault
#pci0 = o3d.camera.PinholeCameraIntrinsic(psd)
#pci0 = o3d.camera.PinholeCameraIntrinsic(2592, 1902, 2045, 2045, 1296, 951)
fx
=
fy
=
2045
pci0
=
o3d
.
camera
.
PinholeCameraIntrinsic
(
2592
,
1902
,
fx
,
fy
,
1296
,
951
)
pcd
=
o3d
.
geometry
.
PointCloud
.
create_from_rgbd_image
(
rgbd_image
,
pci0
)
# Flip it, otherwise the pointcloud will be upside down
pcd
.
transform
([[
1
,
0
,
0
,
0
],
[
0
,
-
1
,
0
,
0
],
[
0
,
0
,
-
1
,
0
],
[
0
,
0
,
0
,
1
]])
o3d
.
visualization
.
draw_geometries
([
pcd
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment