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

ValueError: Invalid number of dimensions for argument 'v_positions'. Expected 2 but got 1. #34

Open
sugizo opened this issue May 22, 2024 · 0 comments

Comments

@sugizo
Copy link

sugizo commented May 22, 2024

env
google colab

steps

pip install -U pymartini point-cloud-utils
!wget -c https://raw.githubusercontent.com/kylebarron/pymartini/master/test/data/fuji.png

code

import imageio.v2 as imageio
from pymartini import decode_ele, Martini, rescale_positions
import point_cloud_utils as pcu

path = './fuji.png'
fuji = imageio.imread(path)
terrain = decode_ele(fuji, 'mapbox')
martini = Martini(fuji.shape[0] + 1)
tile = martini.create_tile(terrain)
vertices, triangles = tile.get_mesh(10)
pcu.save_triangle_mesh(f'{file_name}_pcu.stl', v = vertices, f = triangles)

result

ValueError                                Traceback (most recent call last)
[<ipython-input-10-420b66e278b6>](https://localhost:8080/#) in <cell line: 11>()
      9 tile = martini.create_tile(terrain)
     10 vertices, triangles = tile.get_mesh(10)
---> 11 pcu.save_triangle_mesh(f'{file_name}_pcu.stl', v = vertices, f = triangles)

1 frames
[/usr/local/lib/python3.10/dist-packages/point_cloud_utils/_mesh_io.py](https://localhost:8080/#) in save(self, filename, dtype)
    283                 raise ValueError("Invalid values for wedge colors, must be between 0 and 1 (inclusive)")
    284 
--> 285         save_mesh_internal(filename,
    286                            np.ascontiguousarray(self.vertex_data.positions.astype(dtype)),
    287                            np.ascontiguousarray(self.vertex_data.normals.astype(dtype)),

ValueError: Invalid number of dimensions for argument 'v_positions'. Expected 2 but got 1.

n.b.
the same steps work fine with pydelatin

best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant