Open noamgat opened 4 years ago
Thanks for reporting the issue. I will have a look.
@LMescheder If it helps, I've made all the necessary fixes in this fork.
Specifically, im2mesh/utils/binvox_rw.py and scripts/sample_mesh.py need to be changed.
@jnyjxn Thank you pretty much for your fixes, they work and help me obtain the .binvox files.
Hi, I would like to add that I ran into problems when visualizing the custom .binvox files produced after @LMescheder's fix, the str.encodes() function uses default encoding as UTF-8 format which was causing the problem in visualizing. I changed the coding to latin-1 and things are looking good now. Below is the example with airplane model.
Before:
After
the changes in the binvox_rw.py files look like this
for c in voxels_flat:
if c==state:
ctr += 1
# if ctr hits max, dump
if ctr==255:
# fp.write(chr(state))
# fp.write(chr(ctr))
temp = chr(ctr)
temp1 = str.encode(temp)
fp.write(str.encode(chr(state),encoding='latin-1'))
fp.write(str.encode(chr(ctr),encoding='latin-1'))
ctr = 0
else:
# if switch state, dump
# fp.write(chr(state))
# fp.write(chr(ctr))
fp.write(str.encode(chr(state),encoding='latin-1'))
fp.write(str.encode(chr(ctr),encoding='latin-1'))
state = c
ctr = 1
# flush out remainders
if ctr > 0:
# fp.write(chr(state))
# fp.write(chr(ctr))
fp.write(str.encode(chr(state),encoding='latin-1'))
fp.write(str.encode(chr(ctr),encoding='latin-1'))
When running the sample_mesh.py script with the voxelize flags, I get the following error:
AttributeError: module 'im2mesh.utils.voxels' has no attribute 'voxelize'
In line 158 of sample_mesh.py which is:
When looking at the module, I indeed see no .voxelize function, only voxelize_fill, voxelize_mesh etc. Am I missing something? What is the intended way of using this script for voxel generation?