Hi!
Still very much a beginner to the world of Python and would be grateful for any help to solve an issue!
I have run a YOLO Object Detector algorithm, and have a csv file containing an image name e.g. aoi_yymmdd.png and the object detector bounding box coordinates (xmin, ymin, xmax, ymax). I would like to read this file then save the output file as "bbox_" + "orginal_image_filename". I cannot get the code right so it iterates through all image files in increments, then save with a unique output filename...
I have been attempting to use a list to create an output file name:
How can I create a unique output filename?
Still very much a beginner to the world of Python and would be grateful for any help to solve an issue!
I have run a YOLO Object Detector algorithm, and have a csv file containing an image name e.g. aoi_yymmdd.png and the object detector bounding box coordinates (xmin, ymin, xmax, ymax). I would like to read this file then save the output file as "bbox_" + "orginal_image_filename". I cannot get the code right so it iterates through all image files in increments, then save with a unique output filename...
I have been attempting to use a list to create an output file name:
for i in list(image_files): print("bbox_"+i) out_image = "bbox_" + str(i)I have the output directory open when I run the code, and see all cropped images, but as the filename is the same each time, the outputs just get replaced.
How can I create a unique output filename?
for row in csv_f: im = Image.open(row[0]) cropbbox = (row[1], row[2], row[3], row[4]) cropbbox = map(int, cropbbox) im = im.crop((cropbbox)) im.save(output + out_image + ".png")Thanks in advance
