'name': "right lateral hip angle"
                })

            if is_accurate(left_shoulder.confidence, left_hip.confidence,left_hip.confidence, left_knee.confidence):
                angle = computeAngle(left_shoulder_point, left_hip_point, left_hip_point, left_knee_point)
                standing_accuracy.append({
                    'weight': 25,
                    'angle': angle,
                    'proper_angle': 173,
                    'threshold': 20,
                    'name': "left lateral hip angle"
                })

            if len(standing_accuracy) >= 3:
                #acc = calc_accuracy(standing_accuracy)
                accuracy0 = getAccuracy(standing_accuracy)
                # if  acc > 55:
                #     position = 0 # Standing
                #print "Accuracy standing: ", accuracy0, "with key angles \n", #standing_key_angles[0], "-",standing_key_angles[1], "-",standing_key_angles[2], "-",standing_key_angles[3]
                #for angle in standing_key_angles: print "  ",angle, " - "
                if  accuracy0 > 0.5 and right_foot.confidence == 1 and left_foot.confidence ==1 and math.fabs(right_foot_point[1]-left_foot_point[1])<35:  #SHOULD BE AT LEAST, SEEN FROM ONE SIDE, 0.5!!
                    #position = 0 # Standing
                    posture = "standing"
                    #print "Accuracy standing ", accuracy0
                    

            #######################################################
            # kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated; // Use Seated Mode in Kinect for windows
            # To access the current setting of the pipeline, you can read the TrackingMode again.
                
            #   private void kinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
from openni import *
#import time
from skeleton_extension import limb_angle, print_if_accurate, is_accurate, calc_accuracy, getAccuracy


standing_accuracy = []   # TODO: FRANK : CONSIDERED WAIST NODE FOR BETTER ACCURACY THAN TORSO? -WAIST JOINT DOESNT WORK?
            
standing_accuracy.append({
        'weight': 25,
        'angle': 190,#limb_angle(left_hip_point, left_knee_point, left_foot_point),
        'proper_angle': 180,
        'threshold': 25
})

for function in 
accuracy = getAccuracy(standing_accuracy)
    # if  acc > 55:
    #     position = 0 # Standing
    #print "Accuracy standing: ", accuracy0
    if  accuracy0 >= 0.3:  #SHOULD BE AT LEAST, SEEN FROM ONE SIDE, 0.5!!
        #position = 0 # Standing
        posture = "standing"
        #print "Accuracy standing >=0.5", accuracy0
        
            if is_accurate(left_shoulder.confidence, left_hip.confidence,
                           left_hip.confidence, left_knee.confidence):
                angle = computeAngle(left_shoulder_point, left_hip_point,
                                     left_hip_point, left_knee_point)
                standing_accuracy.append({
                    'weight': 25,
                    'angle': angle,
                    'proper_angle': 173,
                    'threshold': 20,
                    'name': "left lateral hip angle"
                })

            if len(standing_accuracy) >= 3:
                #acc = calc_accuracy(standing_accuracy)
                accuracy0 = getAccuracy(standing_accuracy)
                # if  acc > 55:
                #     position = 0 # Standing
                #print "Accuracy standing: ", accuracy0, "with key angles \n", #standing_key_angles[0], "-",standing_key_angles[1], "-",standing_key_angles[2], "-",standing_key_angles[3]
                #for angle in standing_key_angles: print "  ",angle, " - "
                if accuracy0 > 0.5 and right_foot.confidence == 1 and left_foot.confidence == 1 and math.fabs(
                        right_foot_point[1] - left_foot_point[1]
                ) < 35:  #SHOULD BE AT LEAST, SEEN FROM ONE SIDE, 0.5!!
                    #position = 0 # Standing
                    posture = "standing"
                    #print "Accuracy standing ", accuracy0

            #######################################################
            # kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated; // Use Seated Mode in Kinect for windows
            # To access the current setting of the pipeline, you can read the TrackingMode again.
Ejemplo n.º 4
0
                })
                
            if is_accurate(torso.confidence, left_hip.confidence, left_knee.confidence):
                standing_accuracy.append({
                    'weight': 25,
                    'angle': limb_angle(torso_point, left_hip_point, left_knee_point),
                    'proper_angle': 180,
                    'threshold': 20
                })
                
            #pp = pprint.PrettyPrinter(indent=4)
            #pp.pprint(sitting_accuracy)
            #print calc_accuracy(sitting_accuracy)
            if len(standing_accuracy) >= 2:
                acc = calc_accuracy(standing_accuracy)
                accuracy0 = getAccuracy(standing_accuracy)
                # if  acc > 55:
                #     position = 0 # Standing
                
                if  accuracy0 >= 0.5:  #SHOULD BE AT LEAST, SEEN FROM ONE SIDE, 0.5!!
                    position = 0 # Standing
                    posture = "standing"
                    print "Accuracy standing >0.5", accuracy0
                    

            #######################################################

            sitting_accuracy = []
            
            if is_accurate(left_hip.confidence, left_knee.confidence, left_foot.confidence):
                sitting_accuracy.append({