Ejemplo n.º 1
0
def extrapolate_metadata(directory_path, database_name, mongo_container):
    metadata = load_exif_data(directory_path)

    # Kalman
    kalman = KalmanFilter()
    initial_image_metadata = metadata[0]
    initial_utm = utm.from_latlon(
        initial_image_metadata.get("latitude", None),
        initial_image_metadata.get("longitude", None))
    init_data = np.array([initial_utm[0], initial_utm[1], 0, 0]).T
    init_noise_vec = np.array([
        initial_image_metadata.get("accuracy", None),
        initial_image_metadata.get("accuracy", None), 2, 2
    ]).T
    kalman.initialize(init_data=init_data,
                      init_noise_vec=init_noise_vec,
                      start_timestamp=initial_image_metadata.get("time", None))

    updated_data = update_using_kalman(kalman, metadata)

    geographic_db = GeographicMongoDB(database_name, mongo_container)

    insert_data_to_mongo(geographic_db, updated_data)
Ejemplo n.º 2
0
    geographic_db = GeographicMongoDB(database_name, container_name)

    with open(gpx_file_address) as gpx_file:
        gpx_data = gpxpy.parse(gpx_file)
    video_kalman = KalmanFilter(location_noise=4, speed_noise=3)
    way_points = gpx_data.waypoints
    utm_data = utm.from_latlon(way_points[0].latitude, way_points[0].longitude)
    print(utm_data)
    video = cv.VideoCapture(video_address)
    fake_timestamp = way_points[0].time.timestamp()
    fake_time_start = fake_timestamp
    start_real_time = time.time()
    prev_time = start_real_time
    video_kalman.initialize(
        np.array([utm_data[0], utm_data[1], 0, 0]).T,
        np.array([4, 4, 3, 3]).T, start_real_time)
    index = 1
    video.set(1, 100)
    current_image = ""
    while index < len(way_points):
        if fake_timestamp >= way_points[index].time.timestamp():
            if way_points[index].latitude > 0:
                utm_data = utm.from_latlon(way_points[index].latitude,
                                           way_points[index].longitude)
                video_kalman.update_estimations(np.array(utm_data[:2]).T)
            print(way_points[index])
            index += 1

        success, image = video.read()
        if not success: