stefanv / teaching

Lecture materials
59 stars 29 forks source link

under teaching/skimage/coin_segmentation_tutorial.ipynb #1

Open bicepjai opened 7 years ago

bicepjai commented 7 years ago

under When i run segmentation.mark_boundaries(distance, labels_ws), i get the following error. any idea why ?

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-140-7170fd3acc8c> in <module>()
      6 markers = morphology.label(local_maxi)
      7 labels_ws = watershed(-distance, markers)
----> 8 plt.imshow(segmentation.mark_boundaries(image, labels_ws))
      9 
     10 # from skimage import color

~/Programs/anaconda3/envs/statoilicc/lib/python3.6/site-packages/skimage/segmentation/boundaries.py in mark_boundaries(image, label_img, color, outline_color, mode, background_label)
    213     find_boundaries
    214     """
--> 215     marked = img_as_float(image, force_copy=True)
    216     if marked.ndim == 2:
    217         marked = gray2rgb(marked)

~/Programs/anaconda3/envs/statoilicc/lib/python3.6/site-packages/skimage/util/dtype.py in img_as_float(image, force_copy)
    334 
    335     """
--> 336     return convert(image, np.float64, force_copy)
    337 
    338 

~/Programs/anaconda3/envs/statoilicc/lib/python3.6/site-packages/skimage/util/dtype.py in convert(image, dtype, force_copy, uniform)
    234     if kind_in == 'f':
    235         if np.min(image) < -1.0 or np.max(image) > 1.0:
--> 236             raise ValueError("Images of type float must be between -1 and 1.")
    237         if kind_out == 'f':
    238             # float -> float

ValueError: Images of type float must be between -1 and 1.
stefanv commented 7 years ago

What versions of skimage and numpy are you on?