All problems
Laplacian of a Gaussian (LoG)
Problem
The Laplacian of the 2D Gaussian G(x, y) = exp(-(x^2 + y^2) / (2*sigma^2)) is the Laplacian-of-Gaussian filter.
Its value is ((x^2 + y^2) / sigma^4 - 2 / sigma^2) * G(x, y). Given x, y, and sigma > 0, return that value.
Hint
The LoG is rotationally symmetric and changes sign where x^2 + y^2 = 2*sigma^2.
Test cases
case 1
in: [0,0,1]
expected: -2
case 2
in: [1,0,1]
expected: -0.6065306597126334
case 3
in: [0,0,2]
expected: -0.5
case 4
in: [2,0,1]
expected: 0.2706705664732254
Starter codePython
def laplacian_of_gaussian(x, y, sigma):
# Your code here
pass4 test cases · run your code against them in the editor