pylab.plot(P1[0], P1[1], "go", P2[0], P2[1], "ro")

        ax.set_title("Total cost: %s" % COST)

        for l in LINES:
            pylab.plot((l[0][0], l[1][0]), (l[0][1], l[1][1]), "k-")

        pylab.show()

    a = SC(r_outer=2)
    sampls = 30

    imgs = get_elements("test.png")

    points1, t1 = get_points_from_img("9M.png", simpleto=sampls)
    P = a.compute(points1)
    x1 = [p[0] for p in points1]
    y1 = [400 - p[1] for p in points1]

    for i, img in enumerate(imgs):
        cv.ShowImage("Preview - %s" % i, img)
        cv.WaitKey()
    sys.exit()

    for img in imgs:

        cv.ShowImage("Preview2", img)
        cv.WaitKey()

        points2, t2 = get_points_from_img(img, simpleto=sampls)
Example #2
0
        ax = pylab.subplot(111)
        pylab.grid(True)

        pylab.plot(P1[0], P1[1], 'go', P2[0], P2[1], 'ro')

        ax.set_title('Total cost: %s' % COST)

        for l in LINES:
            pylab.plot((l[0][0], l[1][0]), (l[0][1], l[1][1]), 'k-')

        pylab.show()

    a = SC()
    sampls = 100

    points1, t1 = get_points_from_img('B.png', simpleto=sampls)
    points2, t2 = get_points_from_img('D.png', simpleto=sampls)

    P = a.compute(points1)
    x1 = [p[0] for p in points1]
    y1 = [400 - p[1] for p in points1]
    Q = a.compute(points2)
    x2 = [p[0] for p in points2]
    y2 = [400 - p[1] for p in points2]
    """
    # get rendom r shape contexts from query shape
    Qs,points_ids = a.get_contextes(Q,5)
    points2s = [points2[i] for i in points_ids]
    COST,indexes = a.diff(P,Qs,qlength=len(Q))

        pylab.plot(P1[0],P1[1],'go',P2[0],P2[1],'ro')

        ax.set_title('Total cost: %s' % COST)

        for l in LINES:
            pylab.plot((l[0][0],l[1][0]),(l[0][1],l[1][1]), 'k-')

        pylab.show()

    a = SC(r_outer=2)
    sampls = 30

    imgs = get_elements('test.png')

    points1,t1 = get_points_from_img('9M.png',simpleto=sampls)
    P = a.compute(points1)
    x1 = [p[0] for p in points1]
    y1 = [400-p[1] for p in points1]

    for i,img in enumerate(imgs):
        cv.imshow('Preview - %s' % i,img)
        cv.waitKey(0)
    sys.exit()

    for img in imgs:

        cv.imshow('Preview2',img)
        cv.waitKey(0)

        points2,t2 = get_points_from_img(img,simpleto=sampls)
Example #4
0
        
        pylab.plot(P1[0],P1[1],'go',P2[0],P2[1],'ro')
        
        ax.set_title('Total cost: %s' % COST)       
        
        for l in LINES:     
            pylab.plot((l[0][0],l[1][0]),(l[0][1],l[1][1]), 'k-')
        
        pylab.show()

    a = SC()
    sampls = 100

    imgs = get_elements('test.png')

    points = get_points_from_img('9M2.png',simpleto=sampls)
    P = a.compute(points)
    x1 = [p[0] for p in points]
    y1 = [400-p[1] for p in points]
        
    for img in imgs:
    
        points2 = get_points_from_img(img,simpleto=sampls)
        
        if points2:
            Q = a.compute(points2)
            x2 = [p[0] for p in points2]
            y2 = [400-p[1] for p in points2]
            
            # get rendom r shape contexts from query shape
            Qs,points_ids = a.get_contextes(Q,5)
Example #5
0
        pylab.plot(P1[0], P1[1], 'go', P2[0], P2[1], 'ro')

        ax.set_title('Total cost: %s' % COST)

        for l in LINES:
            pylab.plot((l[0][0], l[1][0]), (l[0][1], l[1][1]), 'k-')

        pylab.show()

    a = SC()
    sampls = 100

    imgs = get_elements('test.png')

    points = get_points_from_img('9M2.png', simpleto=sampls)
    P = a.compute(points)
    x1 = [p[0] for p in points]
    y1 = [400 - p[1] for p in points]

    for img in imgs:

        points2 = get_points_from_img(img, simpleto=sampls)

        if points2:
            Q = a.compute(points2)
            x2 = [p[0] for p in points2]
            y2 = [400 - p[1] for p in points2]

            # get rendom r shape contexts from query shape
            Qs, points_ids = a.get_contextes(Q, 5)
Example #6
0
        pylab.plot(P1[0],P1[1],'go',P2[0],P2[1],'ro')
    
        ax.set_title('Total cost: %s' % COST)     
          
        for l in LINES:     
            pylab.plot((l[0][0],l[1][0]),(l[0][1],l[1][1]), 'k-')
        
        pylab.show()

       

    a = SC()
    sampls = 100


    points1,t1 = get_points_from_img('B.png',simpleto=sampls)
    points2,t2 = get_points_from_img('D.png',simpleto=sampls)

    P = a.compute(points1)
    x1 = [p[0] for p in points1]
    y1 = [400-p[1] for p in points1]
    Q = a.compute(points2)
    x2 = [p[0] for p in points2]
    y2 = [400-p[1] for p in points2]
        
    """
    # get rendom r shape contexts from query shape
    Qs,points_ids = a.get_contextes(Q,5)
    points2s = [points2[i] for i in points_ids]
    COST,indexes = a.diff(P,Qs,qlength=len(Q))
       
Example #7
0
        pylab.plot(P1[0], P1[1], 'go', P2[0], P2[1], 'ro')

        ax.set_title('Total cost: %s' % COST)

        for l in LINES:
            pylab.plot((l[0][0], l[1][0]), (l[0][1], l[1][1]), 'k-')

        pylab.show()

    a = SC()
    sampls = 100

    files = os.listdir(folder)
    for i in range(0, len(files), 2):
        print(files[i])
        points1, t1 = get_points_from_img(os.path.join(folder, files[i]),
                                          simpleto=sampls)
        points2, t2 = get_points_from_img(os.path.join(folder, files[i + 1]),
                                          simpleto=sampls)

        P = a.compute(points1)
        x1 = [p[0] for p in points1]
        y1 = [400 - p[1] for p in points1]
        Q = a.compute(points2)
        x2 = [p[0] for p in points2]
        y2 = [400 - p[1] for p in points2]
        """
        # get rendom r shape contexts from query shape
        Qs,points_ids = a.get_contextes(Q,5)
        points2s = [points2[i] for i in points_ids]
        COST,indexes = a.diff(P,Qs,qlength=len(Q))