コード例 #1
0
def getFeatureVec(fileName, chopFactor, firstRun=False, joints=None):
    headers = open(fileName, "r").readline().split()
    # bug in the files
    headers = jm.getFileHeader(headers)
    ver = jm.getVersion(headers)
    featuresNames = []
    vec = []
    jointsHeaders = headers[2:-4]
    for i, h in enumerate(jointsHeaders):  # drop timestamp, frameNum and floor
        if i % 4 == 3:
            continue
        # time, relJoints = ae.getRelative2AncestorPosition(fileName, h, ver)
        if i % 4 != 0:
            continue
        if not joints is None and not h in joints:
            continue
        try:  # for joints that don't have father and grandfather
            time, _, angles, _ = ae.getAngleVec(fileName, h, False, ver)
            if len(angles) == 0:
                continue
        except Exception, e:  # joint without a father
            continue
        if firstRun:
            print "getAngleVec", h, len(vec)

        v, f = analyzeData(time, angles, h.split("_")[0] + " angle ")
        vec += v
        featuresNames += f
コード例 #2
0
def getExtractor(inputFile):
    f = open(inputFile, 'r')
    headers = f.readline().split()
    ver = jointsMap.getVersion(headers)
    if ver == 'OLD':
        return le.LabanExtractorKinectV1()
    else:
        return le.LabanExtractorKinectV2()