예제 #1
0
                    continue
                elif confirm_button == wiiuse.button['A']:
                    # If the user performed the correct action
                    print "\nSuccess! Performing action...\n"
                    matched_gesture.call_action()

                    stat.confirm(matched_gesture, True)  # Update gesture statistics with a success.
                    # Factor the successful gesture into the gesture's average
                    matched_gesture.update_and_average(performed_gesture.get_frames())
                    # Update the matched gesture on disk
                    writer_reader.update_gesture(matched_gesture)
                    confirmed = True
                elif confirm_button == wiiuse.button['B']:
                    while not confirmed:
                        intended_gesture_name = raw_input("Whoops!  What was your intended gesture?:")
                        intended_gesture = writer_reader.get_gesture_from_name(intended_gesture_name)
                        if intended_gesture is not None:
                            confirmed = True
                            stat.confirm(intended_gesture, False)

                            # If failed gesture, instead update the INTENDED
                            # gesture with the performed gesture iteration
                            intended_gesture.update_and_average(performed_gesture.get_frames())

                            # Suggest that the user re-teach a gesture that is inconsistently successful.
                            if (stat.get_gesture_success_rate(intended_gesture) < 0.6 and
                                    intended_gesture.get_attempts() > 5):
                                recommend_relearn(intended_gesture)

                            # Print statistics regarding the intended gesture
                            print "\n" + (intended_gesture.get_name() + " success rate:").ljust(30) + str(
예제 #2
0
                    matched_gesture.call_action()

                    stat.confirm(
                        matched_gesture,
                        True)  # Update gesture statistics with a success.
                    # Factor the successful gesture into the gesture's average
                    matched_gesture.update_and_average(
                        performed_gesture.get_frames())
                    # Update the matched gesture on disk
                    writer_reader.update_gesture(matched_gesture)
                    confirmed = True
                elif confirm_button == wiiuse.button['B']:
                    while not confirmed:
                        intended_gesture_name = raw_input(
                            "Whoops!  What was your intended gesture?:")
                        intended_gesture = writer_reader.get_gesture_from_name(
                            intended_gesture_name)
                        if intended_gesture is not None:
                            confirmed = True
                            stat.confirm(intended_gesture, False)

                            # If failed gesture, instead update the INTENDED
                            # gesture with the performed gesture iteration
                            intended_gesture.update_and_average(
                                performed_gesture.get_frames())

                            # Suggest that the user re-teach a gesture that is inconsistently successful.
                            if (stat.get_gesture_success_rate(intended_gesture)
                                    < 0.6
                                    and intended_gesture.get_attempts() > 5):
                                recommend_relearn(intended_gesture)