def setup( ):
    s1 = Shape( [ Point(200,340), Point( 0, 200), Point( 350,200) ] )
    s2 = Shape( [ Point(210,320), Point( 5, 205), Point( 340,190) ] )
    s3 = Shape( [ Point(205,300), Point( 10, 190), Point( 344,204) ] )
    s4 = Shape( [ Point(199,380), Point( -5, 205), Point( 333,203) ] )
    s5 = Shape( [ Point(190,290), Point( 0, 190), Point( 351,201) ] )

    asm = PASM( [0,1], 10 )

    asm.addShape( s1 )
    asm.addShape( s2 )
    asm.addShape( s3 )
    asm.addShape( s4 )
    asm.addShape( s5 )
    return asm
示例#2
0
def run():

    asm = PASM([0, 1], 1000)
    allLines = []
    pts = []
    for f in files:
        with open(os.path.join(OUTPUT, f), "r") as infile:

            allLines = infile.readlines()
            if len(allLines) > 0:
                cleanLines = [x.strip().split('\t') for x in allLines]
                ptList = [Point(x[0], x[1]) for x in cleanLines]
                print len(ptList)
                asm.addShape(Shape(ptList))

    asm.iterateAlignment()
示例#3
0
                elif line is '}':
                    pointLine = False
                    pass
                elif pointLine:
                    ptList.append(map(float, line.split(' ')))
                else:
                    pass

        asm.addShape(Shape(ptList))
        m += 1
        print m


if __name__ == "__main__":

    DIR = "C:\\Users\\Valerie\\Desktop\\MicroExpress\\facePoints"
    SUBDIR = "session_1"
    folder = os.path.join(DIR, SUBDIR)
    files = next(os.walk(folder))[2]
    asm = PASM([36, 31], 100)
    readIn(asm, files)
    asm.iterateAlignment()
    with open('outfile-ASM-100iters-500tr.txt', "w") as output:
        output.write(str(asm.meanShape))
        output.write("!!!\n")
        for shape in asm.allShapes:
            output.write(str(shape))
            output.write("@@@\n")
        output.write("!!!\n")