Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading ShapeNet meshes with texture #4362

Closed
janbechtold opened this issue Dec 1, 2021 · 8 comments · Fixed by #6765
Closed

Error loading ShapeNet meshes with texture #4362

janbechtold opened this issue Dec 1, 2021 · 8 comments · Fixed by #6765
Labels
bug Not a build issue, this is likely a bug. io mesh texture

Comments

@janbechtold
Copy link

Describe the bug
When loading specific ShapeNet meshes with Open3D > 0.11, the process ends after printing 'Not a JPEG file: starts with 0x89 0x50'.
In contrast, Open3D version 0.8.0 with python 3.7.9 returns a mesh.

To Reproduce
Steps to reproduce the behavior:
From within your ShapeNetCore.v2 directory...

  1. cd '02801938/d9f0f7cff584b60d826faebfb5cddf3c/models'
  2. source activate yourcondaenv
  3. python

import open3d as o3d
o3d.io.read_triangle_mesh('model_normalized.obj')

  1. See error: Not a JPEG file: starts with 0x89 0x50

(same for this model: 03467517/2cbc0faddf227502bbc745a3524d966b/models)

Expected behavior

  1. A mesh is returned automatically without texture, or
  2. An option to not load the texture, or
  3. A way to catch this in python

Environment (please complete the following information):

  • Operating system: RHEL8
  • Python version: 3.8
  • Open3D version: 0.13.0
  • Is this remote workstation?: yes
  • How did you install Open3D?: conda
@janbechtold janbechtold added the bug Not a build issue, this is likely a bug. label Dec 1, 2021
@wangyePHD
Copy link

In fact, I also meet the same bug when I used the API read_triangle_mesh in the Shapenet-v1.

@wangyePHD
Copy link

And I think that maybe the .obj file has some problem.

@Steven-xzr
Copy link

The same issue with 02691156/de45798ef57fe2d131b4f9e586a6d334

@juc023
Copy link

juc023 commented Jul 3, 2022

How can we solve it? I simply removed that particular data..

@Saafke
Copy link

Saafke commented Aug 2, 2022

It seems the error is with the texture files. If you put the .obj file in a separate folder, it loads in Open3D correctly.

If you need the textures, take a look at this answer: https://blender.stackexchange.com/questions/89010/materials-not-applied-after-importing-obj-shapenet/188192#188192 . You can convert the buggy .obj model from ShapeNet to a .glb model using https://github.com/CesiumGS/obj2gltf.

@yjang2
Copy link

yjang2 commented Apr 27, 2023

The same issue with 02691156/31b201b7346e6cd15e9e2656aff7dd5b

@tomas-aftalion
Copy link

tomas-aftalion commented Aug 17, 2023

For more context on the ShapeNet bug (Stanford url download): it comes from png files having jpg extensions, nothing wrong with the obj file by itself. As mentioned by @Saafke, gets solved by moving to different directory.

In terms of possible fix to o3d: I am able to load the images with matplotlib though. It might be that o3d uses file extensions rather than first bytes to determine file type.

@saurabheights
Copy link
Contributor

@tomas-aftalion yeah, you are right.

https://gist.github.com/leommoore/f9e57ba2aa4bf197ebc5

0x89 0x50 is png magic number.

And open3d does read based on file extension in the name and not using magic number.

file_extension_to_image_read_function{

@ssheorey ssheorey mentioned this issue Apr 23, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug. io mesh texture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants