All problems
Emboss Filter
Problem
Apply the 3x3 emboss kernel [[-2, -1, 0], [-1, 1, 1], [0, 1, 2]] to a grayscale image.
Use valid-mode cross-correlation and return integer values. Negative results are allowed: no clamping or offset is applied.
Test cases
case 1
in: [[[4,4,4],[4,4,4],[4,4,4]]]
expected: [[4]]
case 2
in: [[[1,2,3],[4,5,6],[7,8,9]]]
expected: [[29]]
case 3
in: [[[1,1,1,1],[1,5,5,1],[1,5,5,1],[1,1,1,1]]]
expected: [[21,5],[5,-11]]
Starter codePython
def emboss(image):
# Your code here
pass3 test cases · run your code against them in the editor