0

# Laplacian Filter

Unsolved
###### Computer Vision

Difficulty: 6 | Problem written by mesakarghm
##### Problem reported in interviews at

The Laplacian Filter is an edge detection filter which measures the second derivative in 2D. The Laplacian Filter is:

$$\begin{bmatrix} 0 & 1 & 0\\ 1 & -4 & 1 \\ 0 & 1 & 0 \end{bmatrix}$$

Write a function laplacian_edge(img), which takes in a grayscale image, detect the edges using a Laplacian filter, and returns the resultant image. The shape of the output image should be same as that of the input image.

##### Sample Input:
<class 'numpy.ndarray'>
image: [[ 1 7 119 13 12] [ 11 21 61 81 91] [ 5 66 6 5 5] [ 5 66 166 145 155] [ 5 66 136 145 155]]

##### Expected Output:
<class 'numpy.ndarray'>
[[ 14 113 0 160 56] [ 0 61 0 0 0] [ 62 0 255 217 231] [ 56 39 0 0 0] [ 51 0 0 0 0]]

MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.

Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro

Have an issue, the MLPro support team is available 24X7 to Premium users.