Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dataset = dict()
dataset["image_name"] = list()
dataset["image_width"] = list()
dataset["image_height"] = list()
dataset["top_x"] = list()
dataset["top_y"] = list()
dataset["bottom_x"] = list()
dataset["bottom_y"] = list()
counter = 0
for index, row in df.iterrows():
img = urllib.request.urlopen(row["content"])
img = Image.open(img)
img = img.convert('RGB')
img.save("Indian Number Plates/licensed_car{}.jpeg".format(counter), "JPEG")
dataset["image_name"].append("licensed_car{}".format(counter))
data = row["annotation"]
dataset["image_width"].append(data[0]["imageWidth"])
dataset["image_height"].append(data[0]["imageHeight"])
dataset["top_x"].append(data[0]["points"][0]["x"])
dataset["top_y"].append(data[0]["points"][0]["y"])
dataset["bottom_x"].append(data[0]["points"][1]["x"])
dataset["bottom_y"].append(data[0]["points"][1]["y"])
counter += 1
print("Downloaded {} car images.".format(counter))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment