while( True ):
        try: 
            if yarpRunning:
                print "Waiting for input"
                inputInteractionPort.read(inputBottle,True)

                print(inputBottle.get(0).asString() + 'received')

                if( inputBottle.get(0).asString() == "ask_name" ):

                    #testFace = numpy.zeros([numFaces,imgHNew*imgWNew*3])
                    testFace = numpy.zeros([numFaces,imgHNew*imgWNew])

                    for i in range(numFaces):
                        imageReceived = False
                        imageReceived = mySAMpy.readImageFromCamera()
                        if(imageReceived):
                            testFace[i,:] = mySAMpy.imageFlatten_testing
                        print "face" + str(i)
                    
                    #pp = mySAMpy.testing(testFace, choice, visualiseInfo)
                    ss=numpy.zeros(len(participantList))
                    for i in range(len(Lunique)):
                        testFacen = testFace;
                        #testFacen = testFace - testFace.mean()
                        #testFacen /= testFace.std()
                        #testFacen = testFace - mm[i].Ymean
                        #testFacen /= mm[i].Ystd
                        ss[i] = mm[i].SAMObject.familiarity(testFacen)
                        print('Familiarity with ' + participantList[i] + ' given current face is: ' + str(ss[i]))
Ejemplo n.º 2
0
    pb.draw()
    pb.show()
    visualiseInfo['fig_nn'] = fig_nn
else:
    visualiseInfo = None

# Read and test images from iCub eyes in real-time

#fig_input = pb.figure()
#subplt_input = fig_input.add_subplot(111)

while (True):
    try:
        if yarpRunning:
            choice = inputInteractionPort.read(True)
            testFace = mySAMpy.readImageFromCamera()
        else:
            TODO
        pp = mySAMpy.testing(testFace, choice, visualiseInfo)
        #time.sleep(0.5)
        l = pp.pop()
        l.remove()
        pb.draw()
        pb.waitforbuttonpress(0.1)
        #del l
    except KeyboardInterrupt:
        print 'Interrupted'
        try:
            sys.exit(0)
        except SystemExit:
            os._exit(0)
Ejemplo n.º 3
0
    visualiseInfo['fig_nn']=fig_nn
else:
    visualiseInfo=None

# Read and test images from iCub eyes in real-time

#fig_input = pb.figure()
#subplt_input = fig_input.add_subplot(111)


while( True ):
    pass

    try:        
        choice = inputInteractionPort.read(True)
        testFace = mySAMpy.readImageFromCamera()
        pp = mySAMpy.testing(testFace, choice, visualiseInfo)
        #time.sleep(0.5)
        l = pp.pop()
        l.remove()
        pb.draw()
        pb.waitforbuttonpress(0.1)
        #del l
    except KeyboardInterrupt:
        print 'Interrupted'
        try:
            sys.exit(0)
        except SystemExit:
            os._exit(0)

Ejemplo n.º 4
0
    while (True):
        try:
            if yarpRunning:
                print "Waiting for input"
                inputInteractionPort.read(inputBottle, True)

                print(inputBottle.get(0).asString() + 'received')

                if (inputBottle.get(0).asString() == "ask_name"):

                    #testFace = numpy.zeros([numFaces,imgHNew*imgWNew*3])
                    testFace = numpy.zeros([numFaces, imgHNew * imgWNew])

                    for i in range(numFaces):
                        imageReceived = False
                        imageReceived = mySAMpy.readImageFromCamera()
                        if (imageReceived):
                            testFace[i, :] = mySAMpy.imageFlatten_testing
                        print "face" + str(i)

                    #pp = mySAMpy.testing(testFace, choice, visualiseInfo)
                    ss = numpy.zeros(len(participantList))
                    for i in range(len(Lunique)):
                        testFacen = testFace
                        #testFacen = testFace - testFace.mean()
                        #testFacen /= testFace.std()
                        #testFacen = testFace - mm[i].Ymean
                        #testFacen /= mm[i].Ystd
                        ss[i] = mm[i].SAMObject.familiarity(testFacen)
                        print('Familiarity with ' + participantList[i] +
                              ' given current face is: ' + str(ss[i]))