Aan de slagGa gratis aan de slag

Handwritten letters

A very interesting use of computer vision in real-life solutions is performing Optical Character Recognition (OCR) to distinguish printed or handwritten text characters inside digital images of physical documents.

Let's try to improve the definition of this handwritten letter so that it's easier to classify.

As we can see it's the letter R, already binary, with some noise in it. It's already loaded as upper_r_image.

Apply the morphological operation that will discard the pixels near the letter boundaries.

Deze oefening maakt deel uit van de cursus

Image Processing in Python

Cursus bekijken

Oefeninstructies

  • Import the module from scikit-image.
  • Apply the morphological operation for eroding away the boundaries of regions of foreground pixels.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import the morphology module
from ____

# Obtain the eroded shape 
eroded_image_shape = ____.____(____) 

# See results
show_image(upper_r_image, 'Original')
show_image(eroded_image_shape, 'Eroded image')
Code bewerken en uitvoeren