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():
Result of capture_screen_image():
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
I guess it's because that you have to translate the RGB image to BGR image before you use the cv2.imwrite function, the translate function is cv2.cvtColor()
Checklist
master
branch).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()
:Result of
capture_screen_image()
:Steps to reproduce the bug
Error message
No response
Expected behavior
I expect the same color for both image exports using
capture_screen_float_buffer()
andcapture_screen_image()
, respectively.Open3D, Python and System information
Additional information
No response