@default_selem
def black_tophat(image, selem=None, out=None):
 if (out is image):
  original = image.copy()
 else:
  original = image
 out = closing(image, selem, out=out)
 out -= original
 return out

@ default_selem def black_tophat ( image , selem = None , out = None ) : if ( out is image ) : original = image . copy ( ) else : original = image out = closing ( image , selem , out = out ) out -= original return out
return black top hat of an image .