一、导入点云文件并显示
教程:【CG黑科技】如何在Blender中可视化点云数据?https://www.bilibili.com/video/av93751683/
1. 安装点云显示插件
下载链接:GitHub - uhlik/bpy: blender python scripts
2. 根据b站视频教程安装插件、导入点云
二、利用python脚本自动渲染代码
复制代码
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
70import bpy import numpy as np import math import os import sys ROOT_DIR = "C://Users//11580//Desktop//bpy//" sys.path.insert(1, ROOT_DIR) from space_view3d_point_cloud_visualizer import * tx = 0.0 ty = 2.0 tz = 0.0 rx = 90.0 ry = 0.0 rz = 180.0 fov = 50.0 pi = 3.14159265 scene = bpy.data.scenes["Scene"] # Set render resolution scene.render.resolution_x = 480 scene.render.resolution_y = 359 # Set camera fov in degrees scene.camera.data.angle = fov*(pi/180.0) # Set camera rotation in euler angles scene.camera.rotation_mode = 'XYZ' scene.camera.rotation_euler[0] = rx*(pi/180.0) scene.camera.rotation_euler[1] = ry*(pi/180.0) scene.camera.rotation_euler[2] = rz*(pi/180.0) scene.camera.location.x = tx scene.camera.location.y = ty scene.camera.location.z = tz #创建一个空物体 bpy.ops.object.add(radius=1.0, type='EMPTY', enter_editmode=False, align='WORLD') #bpy.ops.object.add_named(linked=False, name='kong', drop_x=0, drop_y=0) active_object = bpy.context.active_object filepath = "C://Users//11580//Desktop//bunny.ply" controller = PCVControl(active_object) # Load data from ply file pcv = active_object.point_cloud_visualizer pcv.filepath = filepath PCVManager.load_ply_to_cache(None, bpy.context) #edit point cloud #bpy.ops.object.select_all(action='SELECT') bpy.data.objects['Empty'].scale = (1.0, 1.0, 1.0) # Draw point cloud bpy.app.debug_value = 1 c = PCVManager.cache[pcv.uuid] c['draw'] = True controller._redraw() #Render PCV_OT_render.execute(None, bpy.context) #PCV_OT_convert.execute(None, bpy.context) #bpy.ops.object.delete()
最后
以上就是懵懂黑猫最近收集整理的关于利用Blender进行点云渲染的代码一、导入点云文件并显示二、利用python脚本自动渲染代码的全部内容,更多相关利用Blender进行点云渲染内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复