Beispiel #1
0
                    arch_path = '{:s}/{:s}.zip'.format(arch_root_dir,
                                                       arch_name)
                    print 'Reading data for tracker {:d} from zip archive: {:s}'.format(
                        tracker_id, arch_path)
                    if arch_fid:
                        arch_fid.close()
                    arch_fid = zipfile.ZipFile(arch_path, 'r')
                    tracking_data_fname = '{:s}/{:s}/{:s}/{:s}_{:s}_{:s}_{:d}.txt'.format(
                        in_arch_path, actor, seq_name, tracker['sm'],
                        tracker['am'], tracker['ssm'], tracker['iiw'])
                else:
                    tracking_data_fname = '{:s}/tracking_data/{:s}/{:s}/{:s}_{:s}_{:s}_{:d}.txt'.format(
                        tracking_data_root_dir, actor, seq_name, tracker['sm'],
                        tracker['am'], tracker['ssm'], tracker['iiw'])
            print 'Reading tracking data from:: ', tracking_data_fname
            tracking_data = readTrackingData(tracking_data_fname, arch_fid)
            tracking_data_list.append(tracking_data)

        no_of_frames = tracking_data_list[0].shape[0]
        print 'no_of_frames: ', no_of_frames

        tracking_data_win_name = seq_name
        cv2.namedWindow(tracking_data_win_name)

        for frame_id in xrange(no_of_frames):

            ret, curr_img = cap.read()
            if not ret:
                print 'End of sequence reached unexpectedly'
                break
            if convert_to_gs:
Beispiel #2
0
    if len(sys.argv) > arg_id:
        seq_id = int(sys.argv[arg_id])
        arg_id += 1

    if actor is None:
        actor = actors[actor_id]
    if seq_name is None:
        sequences = sequences[actor]
        if seq_id >= len(sequences):
            print 'Invalid dataset_id: ', seq_id
            sys.exit()
        seq_name = sequences[seq_id]

    src_fname = db_root_dir + '/' + actor + '/' + seq_name + '/' + img_name_fmt
    ground_truth_fname = db_root_dir + '/' + actor + '/' + seq_name + '.txt'
    ground_truth = readTrackingData(ground_truth_fname)

    print 'actor: ', actor
    print 'seq_id:', seq_id, 'seq_name:', seq_name

    no_of_frames = ground_truth.shape[0]
    print 'no_of_frames: ', no_of_frames

    split_frames.append(no_of_frames)
    n_split_seq = len(split_frames)

    print 'Splitting sequence: {:s} into {:d} parts ending at the following frames:'.format(
        seq_name, n_split_seq)
    print split_frames

    start_frame_id = 0
Beispiel #3
0
     corrected_corners_fname = gt_corners_fname
 else:
     corrected_corners_fname = db_root_dir + '/' + actor + '/' + seq_name + '_corr.txt'
 if not os.path.isfile(gt_corners_fname) or manual_init:
     print 'ground truth file not found. Using manual object initialization instead'.format(gt_corners_fname)
     sel_pts = getTrackingObject2(init_img)
     init_corners = np.asarray(sel_pts).astype(np.float64).T
     from_last_frame = True
     print 'init_corners:', init_corners
     pause_seq = True
     gt_frames = no_of_frames
     ground_truth = np.empty([1, 8])
     ground_truth[0] = init_corners.flatten(order='F')
     manual_init = True
 else:
     ground_truth = readTrackingData(gt_corners_fname)
     gt_frames = ground_truth.shape[0]
     print 'no_of_frames in ground truth: ', gt_frames
     if gt_frames != no_of_frames:
         print 'Mismatch between the no. of frames in the source directory and the ground truth'
     init_corners = np.asarray([ground_truth[init_frame_id, 0:2].tolist(),
                                ground_truth[init_frame_id, 2:4].tolist(),
                                ground_truth[init_frame_id, 4:6].tolist(),
                                ground_truth[init_frame_id, 6:8].tolist()]).T
 if overwrite_gt and os.path.isfile(gt_corners_fname):
     backup_gt_fname = gt_corners_fname.replace('.txt', '.back_ptf')
     print 'Backing up existing GT to {:s}'.format(backup_gt_fname)
     shutil.move(gt_corners_fname, backup_gt_fname)
 templ_corners = np.asarray([ground_truth[0, 0:2].tolist(),
                             ground_truth[0, 2:4].tolist(),
                             ground_truth[0, 4:6].tolist(),
Beispiel #4
0
    print 'fname: ', fname
    init_img = cv2.imread(fname)
    if len(init_img.shape) == 2:
        init_img = cv2.cvtColor(init_img, cv2.COLOR_GRAY2RGB)

    if use_opt_gt:
        gt_corners_fname = '{:s}/{:s}/OptGT/{:s}_{:s}.txt'.format(db_root_dir, actor, seq_name, opt_gt_ssm)
        sel_corners_fname = '{:s}/{:s}/OptGT/{:s}_{:s}_{:s}.txt'.format(
            db_root_dir, actor, seq_name, opt_gt_ssm, out_suffix)
    else:
        gt_corners_fname = '{:s}/{:s}/{:s}.txt'.format(db_root_dir, actor, seq_name)
        sel_corners_fname = '{:s}/{:s}/{:s}_{:s}.txt'.format(db_root_dir, actor, seq_name, out_suffix)
    print 'Reading ground truth from:: ', gt_corners_fname
    print 'Writing extended ground truth to:: ', sel_corners_fname

    ground_truth = readTrackingData(gt_corners_fname)
    if ground_truth is None:
        raise StandardError('Ground truth could not be read')
    no_of_frames = ground_truth.shape[0]

    file_list = [each for each in os.listdir(src_dir) if each.endswith('.jpg')]
    n_files = len(file_list)

    if n_files != no_of_frames:
        print 'No. of frames in the ground truth: {:d} does not match the no. of images in the sequence: {:d}'.format(
            no_of_frames, n_files)

    print 'no_of_frames: ', no_of_frames

    gt_corners_window_name = '{:d} : {:s}'.format(seq_id, seq_name)