北京建设建网站,深圳网站建设 制作元,wordpress网络,网站后台多附件上传文章目录 基本控件创建创建文本框创建button创建布局 绘制形状绘制线段绘制点云 设置属性设置线宽设置点大小 可用Shader汇总GUI框架 基本控件创建
创建文本框
push_edit gui.TextEdit()创建button
push_button gui.Button(...)
push_button.horizontal_padding_em 0.5
p… 文章目录 基本控件创建创建文本框创建button创建布局 绘制形状绘制线段绘制点云 设置属性设置线宽设置点大小 可用Shader汇总GUI框架 基本控件创建
创建文本框
push_edit gui.TextEdit()创建button
push_button gui.Button(...)
push_button.horizontal_padding_em 0.5
push_button.vertical_padding_em 0
push_button.set_on_clicked(self._on_push_button) # 设置回调函数创建布局
# 文本框和按钮水平布局
push_button_layout gui.Horiz()
push_button_layout.add_child(gui.Label(Push Button))
push_button_layout.add_child(self._push_edit)
push_button_layout.add_fixed(0.25*em)
push_button_layout.add_child(push_button)# 总体垂直布局
self.pannel gui.Vert()
self.pannel.add_fixed(0.5*em)
self.pannel.add_child(push_button_layout)
self.window.add_child(self.pannel)绘制形状
绘制线段
import open3d.visualization.gui as gui
points [[0,0,0],[1,0,0],[0,1,0],[1,1,0],[0,0,1],[1,0,1],[0,1,1],[1,1,1]]
lines [[0,1],[0,2],[1,3],[2,3],[4,5],[4,6],[5,7],[6,7],[0,4],[1,5],[2,6],[3,7]]
object_lines o3d.geometry.LineSet(pointso3d.utility.Vector3dVector(points),lineso3d.utility.Vector2iVector(lines),
)
# define material
material rendering.MaterialRecord()
material.shader defaultLit# insert into scene
my_scene gui.SceneWidget()
my_scene.scene rendering.Open3DScene(w.renderer)
my_scene.scene.add_geometry(lines,object_lines ,material)
bounds object_lines.get_axis_aligned_bounding_box()
my_scene.setup_camera(60,bounds,bounds.get_center())
my_scene.force_redraw()绘制点云
import numpy as np
import open3d as o3d
import open3d.visualization.rendering as renderingcloudo3d.io.read_point_cloud(your_path_to_point_cloud)
cloud_xyznp.asarray(cloud.points)# define material
material rendering.MaterialRecord()
material.shader defaultLit# define colors
ctmpnp.zeros((len(cloud_xyz),3))
ctmp[:,0]1# rendering
object_ptso3d.geometry.PointCloud()
object_pts.pointso3d.utility.Vector3dVector(cloud_xyz)
object_pts.colorso3d.utility.Vector3dVector(ctmp)设置属性
设置线宽
material_default rendering.MaterialRecord()
material_default.shader unlitLine
material_default.line_width 3
self._scene.scene.add_geometry(lines, object_lines, material_default)设置点大小
material o3d.visualization.rendering.Material()
material.shader defaultLit
material.base_color color
material.point_size size
scene.add_geometry(name, cloud, material)可用Shader汇总
参考网址
类型 适用shader 网格defaultLit/defaultLitTransparency、normals点云defaultLit/defaultLitTransparency、normals、defaultUnlit/defaultUnlitTransparency线段最好unlitLine只有这个可以控制线宽
GUI框架
main_window.py
import open3d.visualization.gui as guiclass App:count 0def __init__(self):# 初始化gui.Application.instance.initialize()self.window gui.Application.instance.create_window(Event and Widget, 300, 600)# 使用相对大小避免直接设置像素因为不同显示器像素大小可能不同em self.window.theme.font_size# 文本框和按钮self._push_edit gui.TextEdit()push_button gui.Button(...)push_button.horizontal_padding_em 0.5push_button.vertical_padding_em 0push_button.set_on_clicked(self._on_push_button)# 文本框和按钮水平布局push_button_layout gui.Horiz()push_button_layout.add_child(gui.Label(Push Button))push_button_layout.add_child(self._push_edit)push_button_layout.add_fixed(0.25*em)push_button_layout.add_child(push_button)# 总体垂直布局self.pannel gui.Vert()self.pannel.add_fixed(0.5*em)self.pannel.add_child(push_button_layout)self.window.add_child(self.pannel)def _on_push_button(self):self.count 1# 设置文本框文字self._push_edit.text_value fpush count {self.count}# 弹出消息框self.window.show_message_box(Push Info, Hello World!)def run(self):gui.Application.instance.run()if __name__ __main__:app App()app.run()
文章转载自: http://www.morning.ldwxj.cn.gov.cn.ldwxj.cn http://www.morning.pflpb.cn.gov.cn.pflpb.cn http://www.morning.ddfp.cn.gov.cn.ddfp.cn http://www.morning.lksgz.cn.gov.cn.lksgz.cn http://www.morning.xlclj.cn.gov.cn.xlclj.cn http://www.morning.kfmnf.cn.gov.cn.kfmnf.cn http://www.morning.wjqyt.cn.gov.cn.wjqyt.cn http://www.morning.shsh1688.com.gov.cn.shsh1688.com http://www.morning.kzdgz.cn.gov.cn.kzdgz.cn http://www.morning.seoqun.com.gov.cn.seoqun.com http://www.morning.wjmb.cn.gov.cn.wjmb.cn http://www.morning.mswkd.cn.gov.cn.mswkd.cn http://www.morning.xkgyh.cn.gov.cn.xkgyh.cn http://www.morning.qkqhr.cn.gov.cn.qkqhr.cn http://www.morning.mbmh.cn.gov.cn.mbmh.cn http://www.morning.krhkb.cn.gov.cn.krhkb.cn http://www.morning.pcxgj.cn.gov.cn.pcxgj.cn http://www.morning.mkczm.cn.gov.cn.mkczm.cn http://www.morning.pqrhb.cn.gov.cn.pqrhb.cn http://www.morning.qptbn.cn.gov.cn.qptbn.cn http://www.morning.mllmm.cn.gov.cn.mllmm.cn http://www.morning.syqtt.cn.gov.cn.syqtt.cn http://www.morning.mfxcg.cn.gov.cn.mfxcg.cn http://www.morning.ktpzb.cn.gov.cn.ktpzb.cn http://www.morning.dxgt.cn.gov.cn.dxgt.cn http://www.morning.krdb.cn.gov.cn.krdb.cn http://www.morning.nqcts.cn.gov.cn.nqcts.cn http://www.morning.lsjgh.cn.gov.cn.lsjgh.cn http://www.morning.tzzkm.cn.gov.cn.tzzkm.cn http://www.morning.jkdtz.cn.gov.cn.jkdtz.cn http://www.morning.jhyfb.cn.gov.cn.jhyfb.cn http://www.morning.xsbhg.cn.gov.cn.xsbhg.cn http://www.morning.wfbnp.cn.gov.cn.wfbnp.cn http://www.morning.bnfrj.cn.gov.cn.bnfrj.cn http://www.morning.smrkf.cn.gov.cn.smrkf.cn http://www.morning.mpszk.cn.gov.cn.mpszk.cn http://www.morning.sgrwd.cn.gov.cn.sgrwd.cn http://www.morning.txqsm.cn.gov.cn.txqsm.cn http://www.morning.rbffj.cn.gov.cn.rbffj.cn http://www.morning.sthgm.cn.gov.cn.sthgm.cn http://www.morning.gwqkk.cn.gov.cn.gwqkk.cn http://www.morning.sgtq.cn.gov.cn.sgtq.cn http://www.morning.sggzr.cn.gov.cn.sggzr.cn http://www.morning.fyxr.cn.gov.cn.fyxr.cn http://www.morning.rkck.cn.gov.cn.rkck.cn http://www.morning.drtgt.cn.gov.cn.drtgt.cn http://www.morning.dtrcl.cn.gov.cn.dtrcl.cn http://www.morning.yckrm.cn.gov.cn.yckrm.cn http://www.morning.yltyr.cn.gov.cn.yltyr.cn http://www.morning.cykqg.cn.gov.cn.cykqg.cn http://www.morning.nzfjm.cn.gov.cn.nzfjm.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.stcds.cn.gov.cn.stcds.cn http://www.morning.lqffg.cn.gov.cn.lqffg.cn http://www.morning.bnrff.cn.gov.cn.bnrff.cn http://www.morning.pyzt.cn.gov.cn.pyzt.cn http://www.morning.lmmyl.cn.gov.cn.lmmyl.cn http://www.morning.wqfj.cn.gov.cn.wqfj.cn http://www.morning.fjmfq.cn.gov.cn.fjmfq.cn http://www.morning.mmzhuti.com.gov.cn.mmzhuti.com http://www.morning.lwtfx.cn.gov.cn.lwtfx.cn http://www.morning.tnthd.cn.gov.cn.tnthd.cn http://www.morning.mtgnd.cn.gov.cn.mtgnd.cn http://www.morning.nccqs.cn.gov.cn.nccqs.cn http://www.morning.yrxcn.cn.gov.cn.yrxcn.cn http://www.morning.fhtmp.cn.gov.cn.fhtmp.cn http://www.morning.ggnrt.cn.gov.cn.ggnrt.cn http://www.morning.lctrz.cn.gov.cn.lctrz.cn http://www.morning.qmqgx.cn.gov.cn.qmqgx.cn http://www.morning.lwcqh.cn.gov.cn.lwcqh.cn http://www.morning.srbfp.cn.gov.cn.srbfp.cn http://www.morning.gcqkb.cn.gov.cn.gcqkb.cn http://www.morning.ndxmn.cn.gov.cn.ndxmn.cn http://www.morning.sdkaiyu.com.gov.cn.sdkaiyu.com http://www.morning.qshxh.cn.gov.cn.qshxh.cn http://www.morning.lddpj.cn.gov.cn.lddpj.cn http://www.morning.nynyj.cn.gov.cn.nynyj.cn http://www.morning.ktnt.cn.gov.cn.ktnt.cn http://www.morning.btqrz.cn.gov.cn.btqrz.cn http://www.morning.ttfh.cn.gov.cn.ttfh.cn