43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
import numpy as np
|
|
from pathlib import Path
|
|
from ...google_map import GoogleMap
|
|
from ...simulator import Simulator
|
|
from ...yandex_map import YandexMap
|
|
|
|
LAT_MIN, LAT_MAX = 44.960236, 54.967830
|
|
LON_MIN, LON_MAX = 53.084167, 58.677977
|
|
|
|
def create_new_asset(yandex_map, google_map):
|
|
folder = Path('dataset_ya_go_maps')
|
|
|
|
id = 0
|
|
print(id)
|
|
while (folder / f"{id:0{4}}_google.png").exists():
|
|
id += 1
|
|
|
|
google_file = folder / f"{id:0{4}}_google.png"
|
|
yandex_file = folder / f"{id:0{4}}_yandex.png"
|
|
|
|
lat = np.random.rand() * (LAT_MAX - LAT_MIN) + LAT_MIN
|
|
lon = np.random.rand() * (LON_MAX - LON_MIN) + LON_MIN
|
|
|
|
yandex_map.open(lat, lon, 18)
|
|
google_map.open(lat, lon, 18)
|
|
|
|
simulator = Simulator()
|
|
simulator._apply_perspective_transform(yandex_map.make_screenshot()).save(yandex_file)
|
|
simulator._apply_perspective_transform(google_map.make_screenshot()).save(google_file)
|
|
|
|
def main():
|
|
folder = Path('dataset_ya_go_maps')
|
|
if not folder.exists():
|
|
folder.mkdir()
|
|
|
|
yandex_map = YandexMap(initial_zoom=15)
|
|
google_map = GoogleMap(initial_zoom=15)
|
|
|
|
for i in range(4):
|
|
create_new_asset(yandex_map, google_map)
|
|
|
|
if __name__ == '__main__':
|
|
main() |