All problems
Binary Threshold
Problem
Apply a binary threshold to a grayscale image.
Return 255 where the pixel value is strictly greater than threshold, and 0 otherwise.
Hint
The comparison is strict: a pixel equal to the threshold becomes 0.
Test cases
case 1
in: [[[0,50,100],[150,200,255]],100]
expected: [[0,0,0],[255,255,255]]
case 2
in: [[[100]],100]
expected: [[0]]
case 3
in: [[[101]],100]
expected: [[255]]
Starter codePython
def binary_threshold(image, threshold):
# Your code here
pass3 test cases · run your code against them in the editor