示例#1
0
def test_convex3():
    f = np.array([
        [False, False, False, False],
        [False,  True,  True, False],
        [False,  True, False, False],
        [False, False, False, False]], dtype=bool)
    assert np.all(fill_convexhull(f) == f)
def test_convex3():
    f = np.array([
        [False, False, False, False],
        [False,  True,  True, False],
        [False,  True, False, False],
        [False, False, False, False]], dtype=bool)
    assert np.all(fill_convexhull(f) == f)
def convexHull(bImg):
    label,numLabel=ndimage.label(bImg)
    bImg[:]=False
    for i in range(1,numLabel+1):
        bImgN=label==i
        bImgN=fill_convexhull(bImgN)
        bImg=numpy.logical_or(bImg,bImgN)
    return bImg
示例#4
0
                # contorno, curvatura
                C = contorno(filt, i, 0)
                
                Kurv = curvatura(C, 50)
                
                nbr, L, V = maximos(Kurv, 0.02)

                # area, perimetro, convex hull
                sss = filt.copy()
                sss[filt != i] = 0
                sss[filt == i] = 1
                sss = sss.astype(int)

                # por enquanto removendo convex hull, pois está bugado qhull
                #convex = convex_hull_image(sss)
                convex = mp.fill_convexhull(sss)
                print 'convex hull feito'
                Aor = np.sum(sss)
                Ac = np.sum(convex)
                
                # guarda a quantidade de picos
                qtd_picos.append(nbr)
                # fig2.clf()
                # plot2 = fig2.add_subplot(221)
                # plot2.imshow(convex, cmap=plt.cm.gray, interpolation='nearest')
                # plot2 = fig2.add_subplot(222)
                # plot2.imshow(sss, cmap=plt.cm.gray, interpolation='nearest')
                # plot2 = fig2.add_subplot(223)
                # fig2.savefig('foo.png')
                # perímetro
                peri = len(C)