Skip to content

Commit

Permalink
update rename script
Browse files Browse the repository at this point in the history
  • Loading branch information
xuzebin committed Apr 15, 2017
1 parent 643f9a7 commit b1b5ef3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

"""
A script to rename a set of stereo image pairs so that their names are in a consecutive order (eg. 0L.jpg, 0R.jpg, 1L.jpg, 1R.jpg, etc).
When some chessboard pairs contain outliers, we remove those image pairs, and run this script to reorder.
When some chessboard pairs contain outliers, we remove those image pairs, and run this script to reorder to make the file indices consecutive.
"""

import os
import argparse

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Rename files in a directory. The files must be in the format: %dL.jpg, %dR.jpg, where %d is a number.')
parser.add_argument('-start_index', metavar='start_index', type=int,
help='starting index')
parser.add_argument('start_index', metavar='start_index', type=int,
help='start index of the image pair')
parser.add_argument('end_index', metavar='end_index', type=int,
help='ending index')
help='end index of the image pair')
parser.add_argument('directory', help='the directory containing the files to be renamed')
args = parser.parse_args()

count = 0
for x in range(args.end_index + 1):
for x in range(args.start_index, args.end_index + 1):
left_filename = os.path.join(args.directory, "{0}L.jpg".format(x))
right_filename = os.path.join(args.directory, "{0}R.jpg".format(x))

Expand Down

0 comments on commit b1b5ef3

Please sign in to comment.