Skip to content

Instantly share code, notes, and snippets.

@garybradski
Last active October 6, 2017 03:07
Show Gist options
  • Save garybradski/15d341e006e8ace8b3a21515760592f3 to your computer and use it in GitHub Desktop.
Save garybradski/15d341e006e8ace8b3a21515760592f3 to your computer and use it in GitHub Desktop.
Just a function that reads a line of a text file, strips out [ ] and converts to list of floats
def text_to_floatlist(pathfile):
f = open(pathfile, 'r')
line = f.readline().strip('[]')
f.close()
return [float(x) for x in line.split()]
#Use
rect = text_to_floatlist(seg_bb[frame_count])
if(len(rect) < 4):
logger.critical("Length of rectangle not long enough %d",int(len(rect)) )
return -1
ul = (int(rect[0]), int(rect[1]))
br = (int(rect[2]),int(rect[3]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment