def mask_color(clip, color=[0, 0, 0], thr=0, s=1):
 hill = (lambda x: ((1.0 * (x != 0)) if (thr == 0) else ((x ** s) / ((thr ** s) + (x ** s)))))
 color = np.array(color)
 flim = (lambda im: hill(np.sqrt(((im - color) ** 2).sum(axis=2))))
 mask = clip.fl_image(flim)
 mask.ismask = True
 newclip = clip.set_mask(mask)
 return newclip

def mask_color ( clip , color = [ 0 , 0 , 0 ] , thr = 0 , s = 1 ) : hill = ( lambda x : ( ( 1.0 * ( x != 0 ) ) if ( thr == 0 ) else ( ( x ** s ) / ( ( thr ** s ) + ( x ** s ) ) ) ) ) color = np . array ( color ) flim = ( lambda im : hill ( np . sqrt ( ( ( im - color ) ** 2 ) . sum ( axis = 2 ) ) ) ) mask = clip . fl_image ( flim ) mask . ismask = True newclip = clip . set_mask ( mask ) return newclip
returns a new clip with a mask for transparency where the original clip is of the given color .