Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Color Inversion in Visualizer.capture_screen_float_buffer()

Open marcelbrucker opened this issue 3 years ago • 1 comments

Checklist

Describe the issue

I have been trying to take a screenshot from the Open3d Visualizer and then continue with opencv-python. I noticed that the colors are inverted when I use capture_screen_float_buffer(). capture_screen_image() shows the correct colors.

Result of capture_screen_float_buffer(): Screenshot_cv2

Result of capture_screen_image(): Screenshot_Open3D

Steps to reproduce the bug

import open3d as o3d
import numpy as np
import cv2

eagle = o3d.data.EaglePointCloud()
pcd = o3d.io.read_point_cloud(eagle.path)
pcd.paint_uniform_color([1, 0, 0]) # Red

vis = o3d.visualization.Visualizer()
vis.create_window(width=1920, height=1200, visible=False)
vis.add_geometry(pcd)

vis.capture_screen_image('Screenshot_Open3D.png', do_render=True)

image_o3d = vis.capture_screen_float_buffer(do_render=True)
image_cv2 = (255.0 * np.asarray(image_o3d)).astype(np.uint8)
cv2.imwrite('Screenshot_cv2.png', image_cv2)

Error message

No response

Expected behavior

I expect the same color for both image exports using capture_screen_float_buffer() and capture_screen_image(), respectively.

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) \n[GCC 9.4.0]
- Open3D version: output from python: 0.15.2+429c3fa
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

No response

marcelbrucker avatar Jun 14 '22 16:06 marcelbrucker