def get_centered_blob(img, border_size=1):
img = to_binary_otsu(img)
blob = _get_most_centered_blob(img)
if blob is None:
blob = _get_most_centered_blob(to_binary_otsu(binary_dilation(img)))
if blob is None:
return None
blob_img = add_border(blob, (28, 28), border_size=border_size)
blob_img = to_binary_otsu(blob_img)
return blob_img
评论列表
文章目录