ComenzarEmpieza gratis

Cuando el fondo no es tan evidente

A veces no es tan evidente identificar el fondo. Si el fondo de la imagen es relativamente uniforme, puedes usar un umbral global como vimos antes con threshold_otsu(). Sin embargo, si hay iluminación de fondo desigual, el umbral adaptativo threshold_local() (también llamado umbral local) puede dar mejores resultados.

En este ejercicio, compararás ambos tipos de métodos de umbralización (global y local) para encontrar la forma óptima de obtener la imagen binaria que necesitamos.

Page with text
Imagen cargada como page_image.

Este ejercicio forma parte del curso

Procesamiento de Imágenes en Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Import the otsu threshold function
from skimage.____ import ____

# Obtain the optimal otsu global thresh value
global_thresh = ____(page_image)

# Obtain the binary image by applying global thresholding
binary_global = page_image ____ ____

# Show the binary image obtained
show_image(binary_global, 'Global thresholding')
Editar y ejecutar código