Re: [scikit-image] ValueError: too many values to unpack for measure.marching_cubes
Hi, Functions in Python return objects packed in a tuple. When you write `verts, faces = marching_cubes(...)`, Python computes `marching_cubes(...)`, takes the output, and tries to unpack it (i.e. to assign to the names on the left-hand side of `=`) to 2 objects. The error tells you that the number of objects in a returned tuple is too high (>2). Here is an example to better understand the issue: In [1]: a, b = (1, 2) In [2]: a, b, c = (1, 2) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-5-26c544669ffc> in <module>() ----> 1 a, b, c = (1, 2) ValueError: not enough values to unpack (expected 3, got 2) In [3]: a, b = (1, 2, 3) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-6-2ecd6d570722> in <module>() ----> 1 a, b = (1, 2, 3) ValueError: too many values to unpack (expected 2) In skimage 0.13, as far as I remember, `marching_cubes` is actually an alias to `marching_cubes_lewiner` ( http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.ma...) which returns 4 objects, not 2. In skimage 0.14dev we've already removed this alias. You should either use `marching_cubes_classic` (not recommended), or update your code to use `marching_cubes_lewiner` and unpack the output to 4 variables. Regards, Egor 2017-08-07 17:16 GMT+03:00 wine lover <winecoding@gmail.com>:
Hello,
I have been trying to follow the tutorial here https://www.kaggle.com/ gzuidhof/full-preprocessing-tutorial
However, verts, faces, , = measure.marching_cubes(p, threshold) in the function of plot_3d gives the following error message
File "guidozuidhof_fullprocessing.py", line 90, in plot_3d verts, faces = measure.marching_cubes(p, threshold) ValueError: too many values to unpack
What does that mean, and how to solve it, thanks a lot!
_______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image
participants (1)
-
Egor Panfilov