Exercise

Trying other methods

As we saw in the video, not being sure about what thresholding method to use isn't a problem. In fact, scikit-image provides us with a function to check multiple methods and see for ourselves what the best option is. It returns a figure comparing the outputs of different global thresholding methods.

Forest fruits
Image loaded as fruits_image.

You will apply this function to this image, matplotlib.pyplot has been loaded as plt. Remember that you can use try_all_threshold() to try multiple global algorithms.

Instructions

100 XP
  • Import the try all function.
  • Import the rgb to gray convertor function.
  • Turn the fruits image to grayscale.
  • Use the try all method on the resulting grayscale image.