Skip to content

test data mapbox_st_helens.png and terrarium.png result is not expected #33

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

Open
sugizo opened this issue May 10, 2024 · 4 comments
Open

Comments

@sugizo
Copy link

sugizo commented May 10, 2024

env
google colab

steps

pip install -U pydelatin meshio
!wget -c https://raw.githubusercontent.com/kylebarron/pymartini/master/test/data/mapbox_st_helens.png
!wget -c https://raw.githubusercontent.com/kylebarron/pymartini/master/test/data/terrarium.png

code

import imageio.v2 as imageio
import meshio
from pydelatin import Delatin
from pydelatin.util import decode_ele, rescale_positions

path = './terrarium.png'
terrarium = imageio.imread(path)
terrain = decode_ele(terrarium, 'mapbox')
tin = Delatin(terrain, max_error = 30)
vertices, triangles = tin.vertices, tin.triangles
cells = [("triangle", triangles) ]
mesh = meshio.Mesh(vertices, cells)
mesh.write('terrarium.stl')

result
Screenshot 2024-05-10 095505
Screenshot 2024-05-10 095533

expected result
elevation is show accurately like mt_fuji.png in your github test data
image

best regards

@kylebarron
Copy link
Owner

kylebarron commented May 10, 2024

terrain = decode_ele(terrarium, 'mapbox')

Well this is wrong. You're decoding a terrarium-encoded file as if it were encoded with mapbox encoding

@sugizo
Copy link
Author

sugizo commented May 10, 2024

terrarium.png result is expected when set decode to terrarrium

first post
st_helens is decode using 'mapbox'

this are try to decode st_helens using 'terrarium'

image

still not expected for st_helens.png

best regards

@kylebarron
Copy link
Owner

kylebarron commented May 10, 2024

The St Helens file came from Mapbox, and so that should be loaded with "mapbox" decoding.

From your screenshot, the mesh from St Helens looks flat. You should be able to easily get the elevations of each vertex in the mesh and use numpy to get min/max values. Can you do that and verify that those min/max values are in the range of Mt. St. Helens?

I would not be surprised if the error is in the conversion to meshio, not in my code. I never had an issue like this with pydelatin or with pymartini in production.

@sugizo
Copy link
Author

sugizo commented May 10, 2024

how to get the elevations of each vertex in the mesh and use numpy to get min/max values ?

thanks and 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

2 participants