示例#1
0
    parser.add_argument('--image_set', type=str)

    args = parser.parse_args()

    image_set = args.image_set

    Lref = loadtxt(args.transformed_reference)

    Nc = len(Lref)

    ## Read the estimated orientations
    data_gen = [json.loads(y) for y in open(args.input_file).readlines()]

    qq = [
        (a,
         mtq(fixit(array(b['matrix'])).T),
         b['time']['edge'] + b['time']['est'])
        for a, b in enumerate(data_gen)
        ]

    print qq

    ## Get orientations ordered by frame number
    Lest = array([Quat(x).q for _, x, _ in sorted(qq)])
    times = array([t for _, _, t in sorted(qq)])

    assert len(Lref) == len(Lest)

    # ## Fix and normalize reference quaternions.
    if image_set == 'apast':
        fix_reference_quaternions_apa(Lest)
if __name__ == '__main__':

    with open('bundle.out') as fp:
        aa = fp.readlines()

    Nc = int(aa[1].split(' ')[0])

    Lori = zeros((Nc, 3,3))
    for n in range(Nc):
        for j in range(3):
            Lori[n,j] = array([float(x) for x in aa[3+n*5+j].split(' ')])

    Lq = zeros((Nc,4))
    for n in range(Nc):
        ori = Quat(mtq(Lori[n]))
        Lq[n] = ori.normalize().q * array([1,-1,1,1])

    ## Read the tardiff output





    ## Get orientations ordered by frame number
    Lr = loadtxt('tardiff_undistorted_quaternions.dat')

    ## fix and normalize reference quaternions.
    fix_reference_quaternions(Lr)

    Le = zeros((Nc,4))