peteanderson80 / Matterport3DSimulator

AI Research Platform for Reinforcement Learning from Real Panoramic Images.
Other
503 stars 130 forks source link

Issue with reading depth image #87

Closed awesomericky closed 3 years ago

awesomericky commented 3 years ago

I have some problems in getting depth data from the simulator. As recommended in the instruction, I first generated depth_skybox images. Using these images, in most cases(both scanId and viewpointId) rendering works well. However in some cases, it fails to read depth data from the data directory.

For example, in 'ScanId: 2azQ1b91cZZ / ViewpointId: ac3dc08c7a2646b991fda42ccc42bc47', when I use this setting in 'src/driver/driver.py' the error shows like below.

_libpng error: Read Error Traceback (most recent call last): File "src/driver/driver.py", line 31, in sim.newEpisode(['2azQ1b91cZZ'], ['ac3dc08c7a2646b991fda42ccc42bc47'], [0], [0]) ValueError: MatterSim: Could not open skybox depth files at: ./data/v1/scans//2azQ1b91cZZ/matterport_skybox_images/ac3dc08c7a2646b991fda42ccc42bc47_skybox_depthsmall.png

I think the problem is in .png file. I also tried to read the corresponding image file using 'display' command and the error shows like below.

_intern@mewtwo:/disk2/yunhokim/Matterport3DSimulator/data/v1/scans/2azQ1b91cZZ/matterport_skybox_images$ display ac3dc08c7a2646b991fda42ccc42bc47_skybox_depth_small.png

_display: Expected 8192 bytes; found 7227 bytes ac3dc08c7a2646b991fda42ccc42bc47_skybox_depth_small.png' @ warning/png.c/MagickPNGWarningHandler/1669. display: Read Exceptionac3dc08c7a2646b991fda42ccc42bc47_skybox_depth_small.png' @ error/png.c/MagickPNGErrorHandler/1643. display: corrupt image `ac3dc08c7a2646b991fda42ccc42bc47_skybox_depthsmall.png' @ error/png.c/ReadPNGImage/3971.

Are there anybody who had similar issues with me? Hope for help.

awesomericky commented 3 years ago

Saving corresponding image again in the following procedure solved the problem. I checked it in the simulator and it just worked well with no problem!

from PIL import ImageFile from PIL import Image ImageFile.LOAD_TRUNCATED_IMAGES = True

img = Image.open('ac3dc08c7a2646b991fda42ccc42bc47_skybox_depth_small.png') img.save('img_w_no_problem.png')