Aan de slagGa gratis aan de slag

Defining image convolution kernels

In the previous exercise, you wrote code that performs a convolution given an image and a kernel. This code is now stored in a function called convolution() that takes two inputs: image and kernel and produces the convolved image. In this exercise, you will be asked to define the kernel that finds a particular feature in the image.

For example, the following kernel finds a vertical line in images:

np.array([[-1, 1, -1], 
          [-1, 1, -1], 
          [-1, 1, -1]])

Deze oefening maakt deel uit van de cursus

Image Modeling with Keras

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

kernel = np.array([[____, ____, ____], 
                   [____, ____, ____],
                   [____, ____, ____]])
Code bewerken en uitvoeren