Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

RenderOption customization for non-blocking visualization is not working properly

Open hrimov opened this issue 2 years ago • 0 comments

Checklist

Describe the issue

I have been trying to add some customizations to the Visualizer's RenderOptions, so for example, I was able to override background_color attribute and even to add normals for each point . But I wasn't succeed with the adding coordinate frame, that I really need. I've tested with the blocking visualization and it seems that it relates only to the non-blocking one.

Here are the following images (default and with the overridden attributes) image_2024-01-15_11-17-17 image_2024-01-15_11-15-54

Steps to reproduce the bug

I used an example for the non-blocking visualization and added some lines of code before for-loop (I also tested with the adding such properties inside it).


# ----------------------------------------------------------------------------
# -                        Open3D: www.open3d.org                            -
# ----------------------------------------------------------------------------
# Copyright (c) 2018-2023 www.open3d.org
# SPDX-License-Identifier: MIT
# ----------------------------------------------------------------------------

# examples/python/visualization/non_blocking_visualization.py

import open3d as o3d
import numpy as np


def prepare_data():
    pcd_data = o3d.data.DemoICPPointClouds()
    source_raw = o3d.io.read_point_cloud(pcd_data.paths[0])
    target_raw = o3d.io.read_point_cloud(pcd_data.paths[1])
    source = source_raw.voxel_down_sample(voxel_size=0.02)
    target = target_raw.voxel_down_sample(voxel_size=0.02)

    trans = [[0.862, 0.011, -0.507, 0.0], [-0.139, 0.967, -0.215, 0.7],
             [0.487, 0.255, 0.835, -1.4], [0.0, 0.0, 0.0, 1.0]]
    source.transform(trans)
    flip_transform = [[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]
    source.transform(flip_transform)
    target.transform(flip_transform)
    return source, target


def demo_non_blocking_visualization():
    o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Debug)

    source, target = prepare_data()
    vis = o3d.visualization.Visualizer()
    vis.create_window()
    vis.add_geometry(source)
    vis.add_geometry(target)
    threshold = 0.05
    icp_iteration = 100
    save_image = False

    opt = vis.get_render_option()
    # this option has no effect!!!
    opt.show_coordinate_frame = True
    # but other options will be applied as expected
    opt.point_show_normal = True
    opt.background_color = [0, 0, 0]

    for i in range(icp_iteration):
        reg_p2l = o3d.pipelines.registration.registration_icp(
            source, target, threshold, np.identity(4),
            o3d.pipelines.registration.TransformationEstimationPointToPlane(),
            o3d.pipelines.registration.ICPConvergenceCriteria(max_iteration=1))
        source.transform(reg_p2l.transformation)

        vis.update_geometry(source)
        vis.poll_events()
        vis.update_renderer()
        if save_image:
            vis.capture_screen_image("temp_%04d.jpg" % i)
    vis.destroy_window()

    o3d.utility.set_verbosity_level(o3d.utility.VerbosityLevel.Info)


if __name__ == '__main__':
    demo_non_blocking_visualization()

Error message

No response

Expected behavior

I expected that I could add the coordinate frame to the point cloud as well as normals or changing background color

Open3D, Python and System information

- Operating system: Windows 11 64-bit
- Python version: 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)]
- Open3D version: 0.16.0
- System architecture: x64
- Is this a remote workstation?: no
- How did you install Open3D?: poetry
- Compiler version (if built from source): -

Additional information

No response

hrimov avatar Jan 15 '24 11:01 hrimov