示例#1
0
 def __init__(self, addr, port, window_size=25):
     self._lock = threading.Lock()
     self._skeleton = {}
     # create ZMQ socket for receiving skeleton data
     self.context = zmq.Context()
     self.sub_skel = self.context.socket(zmq.SUB)
     self.sub_skel.connect('tcp://{}:{}'.format(addr, port))
     self.sub_skel.setsockopt(zmq.SUBSCRIBE, '')
     # create thread that receive datas
     t = threading.Thread(target=self.get_skeleton)
     t.daemon = True
     t.start()
     # create reba assessment object
     self.reba = Assessment(window_size)
示例#2
0
import json
from pause.assessment import Assessment
from pause import skeleton_to_joints as skel
import sys

if __name__ == '__main__':
    name = sys.argv[1]
    filename = '/tmp/' + name + '.json'
    with open(filename) as data_file:
        skel_data = json.load(data_file)
    # convert skeleton to joints
    joints_data = skel.convert_skel_to_joints(skel_data)

    print joints_data

    # assess the posture
    reba = Assessment(25)
    score = reba.assess(joints_data)
    print 'name : {}, score = {}'.format(name, score)