mask.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.morphology import binary_closing
6 
7 
8 def bounding_rect_of_mask(img, mask):
9  where = np.argwhere(mask)
10  (y_start, x_start), (y_stop, x_stop) = where.min(0), where.max(0) + 1
11  return img[y_start:y_stop, x_start:x_stop]
12 
13 
14 def descent_closing(mask, init_selem, n_times):
15  S = init_selem.shape
16  for i in xrange(n_times):
17  selem = np.ones((S[0] * (n_times - i), S[1] * (n_times - i)))
18  mask = binary_closing(mask, selem=selem)
19  return mask
def bounding_rect_of_mask(img, mask)
Definition: mask.py:8
def descent_closing(mask, init_selem, n_times)
Definition: mask.py:14


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