ValueError: vertex or face count are zero: terminating marching cubes
akjagadish opened this issue · 1 comments
Was trying to extract vertices, faces and triangles from voxel information and was getting this error.
import numpy as np
import mcubes
from marching_cubes import march
import collada
import pymesh
import sys
inp_file = "../datasets/output/surface-recon/result.dat"
x = np.fromfile(inp_file, dtype=np.uint8)
dim = x[:3]
%Extract necessary elements
voxels = x[12:-16]
voxels = voxels.reshape((dim[0], dim[1], dim[2]))
vertices, normals, triangles = march(voxels, 0)
On running the aforementioned script I get:
ValueError: vertex or face count are zero: terminating marching cubes
Hi,
While you are importing mcubes
, you are actually using another implementation of the marching cubes different from mine (marching_cubes
). The correct way of using mcubes
would be
vertices, triangles = mcubes.marching_cubes(voxels, 0)
The marching_cubes
library you are using is the one from ilastik
. Check https://github.com/ilastik/marching_cubes.