Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-105

Skin-Ratio Mask

Problem

Build a skin mask with the classic RGB rule.

A pixel is skin (255) when r > 95, g > 40, b > 20, max(r, g, b) - min(r, g, b) > 15 and abs(r - g) > 15 all hold; otherwise output 0.

Test cases

case 1
in: [[[[120,80,60]]]]
expected: [[255]]
case 2
in: [[[[90,80,60]]]]
expected: [[0]]
case 3
in: [[[[120,110,60]]]]
expected: [[0]]
case 4
in: [[[[100,50,30]]]]
expected: [[255]]
Starter codePython
def skin_ratio(image):
    # Your code here
    pass

4 test cases · run your code against them in the editor