def __init__(self,path):
blur_radius = 1.0
threshold = 50
img = misc.imread(path)
self.origin = img
# smooth the image (to remove small objects)
imgf = ndimage.gaussian_filter(img, blur_radius)
threshold = 50
# find connected components
self.img, self.count = ndimage.label(imgf > threshold)
self.labels = self.calculate_labels()
# Return
# ----------
# labels : dictionary, key = label, value = list of bounding in order y1, y2, x1, x2
评论列表
文章目录