view python/offset-trajectories.py @ 263:c71540470057

reorganized loading trajectories and objects, added loading feature numbers for objects (the set of features grouped as one moving object
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 25 Jul 2012 22:06:51 -0400
parents 41a5853ec495
children
line wrap: on
line source

#! /usr/bin/env python
import sys

import ubc_utils
import utils

if len(sys.argv) < 3:
    print("Usage: %s filename offsetframes")
    sys.exit()

nFrames = int(sys.argv[2])

def modifyLines(objectNum, lines):
    result = lines
    tmp = lines[0].split(" ")
    firstInstant = int(tmp[1])+nFrames
    lastInstant = int(tmp[2])+nFrames
    tmp[1] = str(firstInstant)
    tmp[2] = str(lastInstant)
    result[0] = " ".join(tmp)
    return result

ubc_utils.modifyTrajectoryFile(modifyLines, sys.argv[1], sys.argv[1]+".new")