Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
justinjohn0306 authored Mar 18, 2021
1 parent fed5c17 commit c5b8a83
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions result/rename_frames.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import glob
import os
import re
import sys

def get_trailing_number(s):
m = re.search(r'\d+$', s)
return int(m.group()) if m else None

# Function to rename multiple files
def main(mypath, name_stub, len_num):
count = 0
files = glob.glob(mypath+"*.png")
for current in files:

number_trailing = re.findall('\d+',current )
number_trailing = [s.lstrip("0") for s in number_trailing]
print(current, mypath+name_stub+str(number_trailing[0]).zfill(len_num)+"_keypoints")
#print(number_trailing)
os.rename(current, mypath+name_stub+"_"+str(count).zfill(len_num)+".png")
count = count + 1

# Driver Code
# Calling main() function, run command ffmpeg -i output_%4d.png output.avi
print(sys.argv)
main(sys.argv[1], "output",4 )

0 comments on commit c5b8a83

Please sign in to comment.