depth.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import numpy as np
5 from skimage.segmentation import slic
6 from skimage.feature import peak_local_max
7 from skimage.morphology import binary_closing
8 
9 from jsk_recognition_utils.mask import descent_closing
10 
11 
12 def split_fore_background(depth_img, footprint=None):
13  if footprint is None:
14  footprint = np.ones((3, 3))
15  segments = slic(depth_img)
16 
17  local_maxi = peak_local_max(
18  depth_img, labels=segments, footprint=footprint, indices=False)
19 
20  fg_mask = descent_closing(local_maxi, init_selem=np.ones((3, 3)), n_times=6)
21  bg_mask = ~fg_mask
22  return fg_mask, bg_mask
def split_fore_background(depth_img, footprint=None)
Definition: depth.py:12


jsk_recognition_utils
Author(s):
autogenerated on Mon May 3 2021 03:03:03