IniziaInizia gratis

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]])

Questo esercizio fa parte del corso

Image Modeling with Keras

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

kernel = np.array([[____, ____, ____], 
                   [____, ____, ____],
                   [____, ____, ____]])
Modifica ed esegui il codice