コード例 #1
0
def follow_gaze(cam, GazeNet):
	center_of_face = []
	while len(center_of_face) == 0:
		img = get_remote_image(cam)
		fd = FD.FaceDetector(img, True)
		center_of_face = fd.detectCenterFaces()
		if len(center_of_face) > 0:
			# get gaze directions
			gaze_coords = GazeNet.getGaze(center_of_face, img)
			cv2.circle(img, (gaze_coords[0], gaze_coords[1]), 10, (0,0,255))
			cv2.imshow("Image", img)
			cv2.waitKey(0)
			cv2.destroyAllWindows()
			# use gaze directions to look and point in that direction
			# gaze predicted location
			look_at_gazed(gaze_coords)
			time.sleep(1.5)
			# detect object
			closest_ball = find_closest_object(cam)
			if closest_ball is None:
			#TODO: Let is say it, and maybe look bakc at parent and/or try again
				print("I don't see what you are looking at")
				tts_p.say("I don't see what you are looking at")
			# if detected:
			# TODO: set a maximum distance.
			if closest_ball is not None:
				look_at_gazed(closest_ball)
				point_at_gazed(gaze_coords, cam)
コード例 #2
0
def detect_face(camera):
	img = get_remote_image(camera)
	fd = FD.FaceDetector(img, True)
	return fd.detectCenterFaces()