5 from skimage.segmentation
import slic
6 from skimage.feature
import peak_local_max
7 from skimage.morphology
import binary_closing
14 footprint = np.ones((3, 3))
15 segments = slic(depth_img)
17 local_maxi = peak_local_max(
18 depth_img, labels=segments, footprint=footprint, indices=
False)
20 fg_mask =
descent_closing(local_maxi, init_selem=np.ones((3, 3)), n_times=6)
22 return fg_mask, bg_mask
def split_fore_background(depth_img, footprint=None)