Beispiel #1
0
def label(bw, connectivity=2):
    '''original label might label any objects at top left as 1. To get around this pad it first.'''
    if bw[0, 0]:
        return skim_label(bw, connectivity=connectivity)
    bw = np.pad(bw, pad_width=1, mode='constant', constant_values=False)
    labels = skim_label(bw, connectivity=connectivity)
    labels = labels[1:-1, 1:-1]
    return labels
Beispiel #2
0
def skilabel(bw, conn=2):
    '''original label might label any objects at top left as 1. To get around this pad it first.'''
    bw = np.pad(bw, pad_width=1, mode='constant', constant_values=False)
    label = skim_label(bw, connectivity=conn)
    label = label[1:-1, 1:-1]
    return label