Last active
October 6, 2017 03:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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