All problems
Chroma Key Removal
Problem
Replace pixels similar to a chroma key color with black.
For every pixel compute the Euclidean distance in RGB space to key_color; if it is less than or equal to tolerance replace the pixel with [0, 0, 0], otherwise keep it unchanged.
Test cases
case 1
in: [[[[0,255,0],[100,100,100]]],[0,255,0],0]
expected: [[[0,0,0],[100,100,100]]]
case 2
in: [[[[0,255,0],[5,250,5]]],[0,255,0],10]
expected: [[[0,0,0],[0,0,0]]]
case 3
in: [[[[0,128,0],[0,0,255]]],[0,255,0],0]
expected: [[[0,128,0],[0,0,255]]]
Starter codePython
def chroma_key(image, key_color, tolerance):
# Your code here
pass3 test cases · run your code against them in the editor