18 if not os.path.exists(info):
19 raise Exception(
"failed to find %s" % info)
20 with open(info,
"r") as input_f: 21 lines = input_f.readlines() 22 cv2.namedWindow("image")
26 (fname, num, x, y, width, height) = [c
for c
in line.split()
27 if c
and c.strip(
"\n ")]
32 if os.path.exists(fname):
33 print(
"Opening " + fname)
34 img = cv2.imread(fname)
35 cv2.rectangle(img, (x, y),
36 (x + width, y + height),
38 cv2.imshow(
"image", img)
41 results.append((fname, num, x, y, width, height))
44 with open(output,
"w")
as output_f:
45 for result
in results:
46 output_f.write(
"%s %d %d %d %d %d\n" % (result[0],
53 if __name__ ==
"__main__":