(imgdir=None, mode=u'RGB', **kwargs)
return tracker
Sets up an ImageTracker instance with a GUI.
Sets up an ImageTracker instance with a GUI.
Sets up an ImageTracker instance with a GUI .
def setup(imgdir=None, mode=u'RGB', **kwargs):
	
	"""Sets up an ImageTracker instance with a GUI.
	"""
	
	# Open WebCamTracker.
	tracker = ImageTracker(imgdir=imgdir, mode=mode, **kwargs)
	
	# OpenCV keycodes on Windows.
	# TODO: Put these in a dict, and handle their purpose through a separate function.
	up = 2490368
	down = 2621440
	left = 2424832
	right = 2555904
	space = 32
	escape = 27

	# Stream the collected images.
	running = True
	while running:
		
		# PROCESS FRAME
		# Get a frame.
		success, frame = tracker._get_frame()

		# Only process the frame if there is one.
		if success:

			# Write the current threshold on the frame.
			cv2.putText(frame, u"pupthresh = %d" % (tracker._pupt), \
				(10,50), cv2.FONT_HERSHEY_SIMPLEX, 1, 255)
			
			# TODO: Rewrite image processing functions in 'generic'
			# with an optional setup/debug keyword that activates the
			# returning of variables we need for drawing the things that
			# are relevant to setting up the tracker, e.g. face offset,
			# eye offset, pupil rect.
			# TODO: Draw a rect around face.
			# TODO: Draw rects around the eyes.
			# TODO: Draw rects around the pupils.
			# TODO: Shade thresholded pixels in the pupil.

		# USER INTERACTION
		if success:
			# Show the frame
			cv2.imshow('PyGazeTracker Setup', frame)
			# Briefly wait for a key press
			keycode = cv2.waitKey(10)
			if keycode != -1:
				print keycode
			if keycode == up:
				tracker._pupt += 1
			elif keycode == down:
				tracker._pupt -= 1
			elif keycode == left:
				tracker._glit -= 1
			elif keycode == right:
				tracker._glit += 1
			elif keycode == space or keycode == escape:
				running = False
	
	return tracker
def setup ( imgdir = None , mode = u'RGB' , * * kwargs ) : # Open WebCamTracker. tracker = ImageTracker ( imgdir = imgdir , mode = mode , * * kwargs ) # OpenCV keycodes on Windows. # TODO: Put these in a dict, and handle their purpose through a separate function. up = 2490368 down = 2621440 left = 2424832 right = 2555904 space = 32 escape = 27 # Stream the collected images. running = True while running : # PROCESS FRAME # Get a frame. success , frame = tracker . _get_frame ( ) # Only process the frame if there is one. if success : # Write the current threshold on the frame. cv2 . putText ( frame , u"pupthresh = %d" % ( tracker . _pupt ) , ( 10 , 50 ) , cv2 . FONT_HERSHEY_SIMPLEX , 1 , 255 ) # TODO: Rewrite image processing functions in 'generic' # with an optional setup/debug keyword that activates the # returning of variables we need for drawing the things that # are relevant to setting up the tracker, e.g. face offset, # eye offset, pupil rect. # TODO: Draw a rect around face. # TODO: Draw rects around the eyes. # TODO: Draw rects around the pupils. # TODO: Shade thresholded pixels in the pupil. # USER INTERACTION if success : # Show the frame cv2 . imshow ( 'PyGazeTracker Setup' , frame ) # Briefly wait for a key press keycode = cv2 . waitKey ( 10 ) if keycode != - 1 : print keycode if keycode == up : tracker . _pupt += 1 elif keycode == down : tracker . _pupt -= 1 elif keycode == left : tracker . _glit -= 1 elif keycode == right : tracker . _glit += 1 elif keycode == space or keycode == escape : running = False return tracker