[Fix] Problem of failing to save images after open3d visualization#3058
Open
Aiuan wants to merge 2 commits intoopen-mmlab:mainfrom
Open
[Fix] Problem of failing to save images after open3d visualization#3058Aiuan wants to merge 2 commits intoopen-mmlab:mainfrom
Aiuan wants to merge 2 commits intoopen-mmlab:mainfrom
Conversation
Co-authored-by: Christian Behrens <9531979+chbehrens@users.noreply.github.com>
| Thank you. It worked. They haven't had any activity for almost a year. Do you know what happened? |
| I recommend adding self.o3d_vis.clear_geometries() after the exported image, because the current modification causes two images to be rendered in a row, and the result of the previous image is saved to the next one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
While verifying the inference demo according to the following code in Get Started, we often find that the open3d library can visualize the point cloud and detection results, but after closing the visualization window, the results are not saved to the image (the image is often completely black). To fix this issue we raised this PR.
Code:
Visualize window:

Saved image (before modification):

Modification
We modify the
show()function in the mmdet3d/visualization/local_visualizer.py file.self.o3d_vis.clear_geometries()in line 887, because geometries should not be cleared before saving as an image.self.o3d_vis.capture_screen_image(save_path)in line 896 toself.o3d_vis.capture_screen_image(save_path, do_render=True), because we need to re-render after manually closing the visualization window to ensure that the stored image is not empty.After our modification, the visualization results can be saved to the image normally.
Saved image (after modification):
