示例#1
0
文件: GUI.py 项目: mdiannna/cGRS
 def run(self):
     global Diana
     Diana = recogGest()
     print "Starting " + self.name + Diana
     recognition(self.name, self.counter, 5)
     
     print "Exiting " + self.name
示例#2
0
文件: GUI.py 项目: mdiannna/cGRS
def recognition(threadName, delay, counter):
    global Diana
    while not exitFlag:
        if exitFlag:
            threadName.exit()
        Diana = recogGest()
        # box.insert(0, Diana)
        time.sleep(0.5)
        print "%s: %s" % (threadName, time.ctime(time.time()))
        counter -= 1
示例#3
0
文件: main.py 项目: mdiannna/cGRS
    # win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)

if __name__ == "__main__":
	command = sys.argv[2]
	com_port = sys.argv[1]
	try:
		server = sys.argv[3]
	except:
		server = "ws://localhost:5000/echo"

	init_GRS(com_port, server)
	init_server(server)

	# print "get data:"
	# print get_data()

	#trainGest("Vitea")
#	print "gesture:"
	print "gesture: " + recogGest()

	#if recogGest() == "click":
	#	print "click"
	# 	click(10, 10)

	stop_server_conn()
	stop_serial_conn()


示例#4
0
from grslib import init_GRS, get_raw_data, get_data, init_server, stop_server_conn, stop_serial_conn
from grsNN import recogGest, trainGest
import sys, time
import win32api, win32con

def click(x,y):
    # win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)

SAMPLES = 10

if __name__ == "__main__":
	command = sys.argv[2]
	com_port = sys.argv[1]

	init_GRS(com_port, server)

	for i in range(0, SAMPLES):
		gest = recogGest()
		print "----- Recognized gesture:  " + gest
		if gest == "click":
			print "click"
			click(10, 10)
		time.sleep(2)

	stop_serial_conn()