elif (smile_prob >= 1): print "smile detected!" smiledetectTime = datetime.now() print "smile time: %s" %smiledetectTime lag = smiledetectTime - facedetectTime print "lag: %s" %lag # # pdb.set_trace() cv2.imshow("ROI", roi_gray) cv2.imshow('ROI_resized', resized_roi) # cv2.imshow('Video', self.image) if cv2.waitKey(1) & 0xFF == ord('q'): pass if __name__ == '__main__': #pdb.set_trace() model = train_smiles() print "training smile detector!" rospy.init_node('convertingNumpy', anonymous =True) df = smileDetect() print "running Smile Detector!" try: print "rospy.spin!" rospy.spin() except KeyboardInterrupt: print "Quitting program" cv2.destroyAllWindows()
print "smile detected!" smiledetectTime = datetime.now() print "smile time: %s" % smiledetectTime lag = smiledetectTime - facedetectTime print "lag: %s" % lag # # pdb.set_trace() cv2.imshow("ROI", roi_gray) cv2.imshow('ROI_resized', resized_roi) # cv2.imshow('Video', self.image) if cv2.waitKey(1) & 0xFF == ord('q'): pass if __name__ == '__main__': #pdb.set_trace() model = train_smiles() print "training smile detector!" rospy.init_node('convertingNumpy', anonymous=True) df = smileDetect() print "running Smile Detector!" try: print "rospy.spin!" rospy.spin() except KeyboardInterrupt: print "Quitting program" cv2.destroyAllWindows()
#move robot! this is kind of a state machine if command == "forward": velocity_msg = Twist(Vector3((0.1), 0.0, 0.0), Vector3(0.0, 0.0, 0.0)) print(":D Hi there!") # rsleep = r*100 # rsleep.sleep() elif command == "back": velocity_msg = Twist(Vector3(-0.1, 0.0, 0.0), Vector3(0.0, 0.0, 0.0)) print(":( i'll go away now....") else: #stay there velocity_msg = Twist(Vector3(0.0, 0.0, 0.0), Vector3(0.0, 0.0, 0.0)) print("is anyone here? waiting for command") pub.publish(velocity_msg) r.sleep() if __name__ == '__main__': try: video_capture = cv2.VideoCapture(0) #init first frame rospy.init_node('teleop', anonymous=True) #create teleop node model = train_smiles() #run code to generate smile detector while not rospy.is_shutdown(): detectFaces() #run code that runs everything else except rospy.ROSInterruptException: pass