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

Voxelized model is skewed and looks weird :-( pls help #476

Open
ferbrjan opened this issue Aug 4, 2021 · 8 comments
Open

Voxelized model is skewed and looks weird :-( pls help #476

ferbrjan opened this issue Aug 4, 2021 · 8 comments

Comments

@ferbrjan
Copy link

ferbrjan commented Aug 4, 2021

Hi there,

I ran into a problem while trying to voxelize some .obj files that I created using meshlab. The goal was to extract some objects from 3D models, voxelize those objects and the maps, label each of the objects by a corresponding class and then put the objects back into the voxelized map. Therefore the result would be a voxelized environment with labeled objects. Everything was going good until I ran into a problem with the voxelize function. Everytime I voxelize any format (.obj, .stl, .ply) I always recieve model that is slightly skewed. I am setting the check_surface to False since my map and objects all contain holes etc.

Please help :-(

My super simple code:

surface = pv.read("file.obj")
surface
voxels = pv.voxelize(surface, density=0.1,check_surface=False)
voxels
voxels.save("file.vtk")

.obj file visualization
Snímek obrazovky 2021-08-04 v 12 57 04

voxelization using online voxelizer (my desired result)
Snímek obrazovky 2021-08-04 v 12 58 25

voxelization using pyvista.voxelize()
Snímek obrazovky 2021-08-04 v 13 00 59

@RichardScottOZ
Copy link

What does the original import look like and after voxelisation? How did the final plot get done?

@ferbrjan
Copy link
Author

ferbrjan commented Aug 4, 2021

this is how the import looks like after surface.plot()
Snímek obrazovky 2021-08-04 v 13 17 08

this is how the voxelistaion looks like after voxels.plot()
Snímek obrazovky 2021-08-04 v 13 19 23

@ferbrjan
Copy link
Author

ferbrjan commented Aug 4, 2021

It makes no sense that a online voxelizer on https://drububu.com/miscellaneous/voxelizer does the job correctly, binvox at https://www.patrickmin.com/binvox/ also works great, but this voxelize function creates this weird looking shapes :(

And since I would need to run this on 500+ files, online voxelizer is not an option, and binvox does not keep the information about the location of the object in the map

@RichardScottOZ
Copy link

What does a different density do, 0.01 etc?

@ferbrjan
Copy link
Author

ferbrjan commented Aug 4, 2021

My mesh is in metric units, that means that density 1 would mean a voxel of size 1m x 1m x 1m, 0.1 means voxel of 10cm x 10cm x 10cm , 0.01 would mean voxel size of 1cm x 1cm x 1cm....
At least that's how I understand it.

@RichardScottOZ
Copy link

Yes, so what does it look like at higher res?

@ferbrjan
Copy link
Author

ferbrjan commented Aug 4, 2021

Really similar from what I've tried... It's better with higher resolution, but I need the resolution to be at the 10x10x10cm, since the map itself is otherwise greater than 10GB. Also as you can see on the screenshot from https://drububu.com/miscellaneous/voxelizer the resolution is sufficient for the model. (the length of the longest side model is approx 23m and the longest side is split into 189 voxels which is more or less 12x12x12cm)

@RichardScottOZ
Copy link

If it is the right type PVGeo has a voxelise points function, too.

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