Get startedGet started for free

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

This exercise is part of the course

Image Modeling with Keras

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

kernel = np.array([[____, ____, ____], 
                   [____, ____, ____],
                   [____, ____, ____]])
Edit and Run Code