Open3d笔记

open3d 例程

1.kitti-Semantic:

https://github.com/Jiang-Muyun/Open3D-Semantic-KITTI-Vis

2.阿波罗例子

https://www.pythonf.cn/read/111217

3.open3d Advance

https://github.com/intel-isl/Open3D/tree/master/examples/Python/Advanced

4.Open3d传感器

https://github.com/intel-isl/Open3D/blob/183421d8ee6bd70be3f6dc6471926369027e9878/examples/Python/ReconstructionSystem/sensors/realsense_pcd_visualizer.py

第一步:
读取数据 生成pcd点云图
open3d.io
第二步:
对点云进行色彩,挑选等操作
open3d.geometry
open3d.
open3d.integration TSDF体像素生成

第三步:
可视化显示
open3d.visualization

http://www.open3d.org/docs/release/tutorial/Advanced/color_map_optimization.html

Open3d example:
https://github.com/intel-isl/Open3D/tree/master/examples/Python/Advanced
十分重要的例子
https://github.com/intel-isl/Open3D/blob/183421d8ee6bd70be3f6dc6471926369027e9878/examples/Python/ReconstructionSystem/sensors/realsense_pcd_visualizer.py

def get_intrinsic_matrix(frame):
intrinsics = frame.profile.as_video_stream_profile().intrinsics
out = o3d.camera.PinholeCameraIntrinsic(640, 480, intrinsics.fx,
intrinsics.fy, intrinsics.ppx,
intrinsics.ppy)

保存视角,导入视角

https://github.com/intel-isl/Open3D/issues/615

https://github.com/intel-isl/Open3D/pull/597

调整视角

ctr = vis.get_view_control()
parameters = o3d.io.read_pinhole_camera_parameters(“ScreenCamera_xxxx.json”)
ctr.convert_from_pinhole_camera_parameters(parameters)

https://github.com/intel-isl/Open3D/issues/1483

调整背景颜色

opt = vis.get_render_option()
opt.background_color = np.asarray([0, 168/255., 1.0])

https://github.com/intel-isl/Open3D/issues/1389
https://github.com/intel-isl/Open3D/issues/1389

open3d 论坛

https://forum.open3d.org/c/rendering

选取点云

pcd_tree
pcd_tree.search_knn_vector_3d(pcd.points[K], 50)
https://blog.csdn.net/suyunzzz/article/details/105183824
http://www.open3d.org/docs/release/tutorial/Basic/kdtree.html

class PickedPoint(__pybind11_builtins.pybind11_object):
    # no doc
    def __init__(self): # real signature unknown; restored from __doc__
        """ __init__(self: open3d.open3d_pybind.visualization.PickedPoint) -> None """
        pass

    coord = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default

    index = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default

保存图像

capture_screen_image(self, filename, do_render=False)

    Function to capture and save a screen image

    Parameters

            filename (str) – Path to file.

            do_render (bool, optional, default=False) – Set to True to do render.

    Returns

        None

显示设置

customized_visualization.py

https://github.com/intel-isl/Open3D/blob/d50699b16ca726bb366ad65eea0c2a8c52f02723/examples/Python/Advanced/customized_visualization.py

欧拉角、四元数https://github.com/thecountoftuscany/PyTeapot-Quaternion-Euler-cube-rotation
https://github.com/thecountoftuscany/PyTeapot-Quaternion-Euler-cube-rotation

相机参数结构

def save_intrinsic_as_json(filename, frame):
intrinsics = frame.profile.as_video_stream_profile().intrinsics
with open(filename, ‘w’) as outfile:

    obj = json.dump(
        {
            'width':
                intrinsics.width,
            'height':
                intrinsics.height,
            'intrinsic_matrix': [
                intrinsics.fx, 0, 0, 0, intrinsics.fy, 0, intrinsics.ppx,
                intrinsics.ppy, 1
            ]
        },
        outfile,
        indent=4)

set_lookat

ctr = vis.get_view_control()
ctr.set_lookat([0, 0, 0.3])

[x , y , z]

x:水平方向 左右移动
y:垂直方向 位置
z:前后位置

快捷键

[Open3D INFO]   -- Mouse view control --
[Open3D INFO]     Left button + drag         : Rotate.
[Open3D INFO]     Ctrl + left button + drag  : Translate.
[Open3D INFO]     Wheel button + drag        : Translate.
[Open3D INFO]     Shift + left button + drag : Roll.
[Open3D INFO]     Wheel                      : Zoom in/out.
[Open3D INFO] 
[Open3D INFO]   -- Keyboard view control --
[Open3D INFO]     [/]          : Increase/decrease field of view.
[Open3D INFO]     R            : Reset view point.
[Open3D INFO]     Ctrl/Cmd + C : Copy current view status into the clipboard.
[Open3D INFO]     Ctrl/Cmd + V : Paste view status from clipboard.
[Open3D INFO] 
[Open3D INFO]   -- General control --
[Open3D INFO]     Q, Esc       : Exit window.
[Open3D INFO]     H            : Print help message.
[Open3D INFO]     P, PrtScn    : Take a screen capture.
[Open3D INFO]     D            : Take a depth capture.
[Open3D INFO]     O            : Take a capture of current rendering settings.
[Open3D INFO] 
[Open3D INFO]   -- Render mode control --
[Open3D INFO]     L            : Turn on/off lighting.
[Open3D INFO]     +/-          : Increase/decrease point size.
[Open3D INFO]     Ctrl + +/-   : Increase/decrease width of geometry::LineSet.
[Open3D INFO]     N            : Turn on/off point cloud normal rendering.
[Open3D INFO]     S            : Toggle between mesh flat shading and smooth shading.
[Open3D INFO]     W            : Turn on/off mesh wireframe.
[Open3D INFO]     B            : Turn on/off back face rendering.
[Open3D INFO]     I            : Turn on/off image zoom in interpolation.
[Open3D INFO]     T            : Toggle among image render:
[Open3D INFO]                    no stretch / keep ratio / freely stretch.
[Open3D INFO] 
[Open3D INFO]   -- Color control --
[Open3D INFO]     0..4,9       : Set point cloud color option.
[Open3D INFO]                    0 - Default behavior, render point color.
[Open3D INFO]                    1 - Render point color.
[Open3D INFO]                    2 - x coordinate as color.
[Open3D INFO]                    3 - y coordinate as color.
[Open3D INFO]                    4 - z coordinate as color.
[Open3D INFO]                    9 - normal as color.
[Open3D INFO]     Ctrl + 0..4,9: Set mesh color option.
[Open3D INFO]                    0 - Default behavior, render uniform gray color.
[Open3D INFO]                    1 - Render point color.
[Open3D INFO]                    2 - x coordinate as color.
[Open3D INFO]                    3 - y coordinate as color.
[Open3D INFO]                    4 - z coordinate as color.
[Open3D INFO]                    9 - normal as color.
[Open3D INFO]     Shift + 0..4 : Color map options.
[Open3D INFO]                    0 - Gray scale color.
[Open3D INFO]                    1 - JET color map.
[Open3D INFO]                    2 - SUMMER color map.
[Open3D INFO]                    3 - WINTER color map.
[Open3D INFO]                    4 - HOT color map.

设置 lookat

vis = o3d.visualization.Visualizer()
#o3d.visualization.draw_geometries([pcd],window_name='Open3D', width=1280, height=720, left=500, top=500)
vis.create_window(window_name="o3d", width=1920, height=1080, left=50, top=50,visible= True)
pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
vis.add_geometry(pcd)
ctr = vis.get_view_control()
ctr.set_lookat([-0.3, 0.5, 0.3])
ctr.set_front([0.1, 0.3, 0.2])
#ctr.set_up([0.3, 0.3768, 0.8024])
ctr.set_zoom(0.512)![在这里插入图片描述](https://img-blog.csdnimg.cn/20200601190235810.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzI2NjIzODc5,size_16,color_FFFFFF,t_70)
vis.run()
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()

convert_from_pinhole_camera_parameters

https://github.com/intel-isl/Open3D/issues/727
Open3d笔记_第1张图片

And pointcloud in the same window

在这里插入图片描述
https://github.com/intel-isl/Open3D/issues/609

在窗口中显示图片

https://github.com/intel-isl/Open3D/issues/1784

CV2指定位置添加图片

https://blog.csdn.net/weixin_33817333/article/details/88766968
https://blog.csdn.net/sinat_38814578/article/details/83184742

    import cv2
    import numpy as np
     
    img1 = cv2.imread('img.jpg')
    img2 = cv2.imread('img1.jpg')
     
    img2 = cv2.resize(img2,(100,100))
    # I want to put logo on top-left corner, So I create a ROI
    rows,cols,channels = img2.shape
    roi = img1[0:rows, 0:cols ]
     
    # Now create a mask of logo and create its inverse mask also
    img2gray = cv2.cvtColor(img2,cv2.COLOR_BGR2GRAY)
    ret, mask = cv2.threshold(img2gray, 200, 255, cv2.THRESH_BINARY)
    mask_inv = cv2.bitwise_not(mask)
     
    # Now black-out the area of logo in ROI
    img1_bg = cv2.bitwise_and(roi,roi,mask = mask)
     
    # Take only region of logo from logo image.
    img2_fg = cv2.bitwise_and(img2,img2,mask = mask_inv)
     
    # Put logo in ROI and modify the main image
    dst = cv2.add(img1_bg,img2_fg)
    img1[0:rows, 0:cols ] = dst
     
    cv2.imshow('res',img1)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

你可能感兴趣的:(Open3d笔记)