-
-
Save amankharwal/f6829d433122713b177e112b060cf926 to your computer and use it in GitHub Desktop.
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
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