MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Image Processing in Python

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Import the try all function
from skimage.____ import ____

# Import the rgb to gray convertor function 
from skimage.____ import ____

# Turn the fruits_image to grayscale
grayscale = ____

# Use the try all method on the resulting grayscale image
fig, ax = ____(____, verbose=False)

# Show the resulting plots
plt.show()
Edit dan Jalankan Kode