Commit 8fe4b1aa authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

test model

parent c0fbf9a8
...@@ -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
......
# 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
# 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
# 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])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment