-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from prime-slam/google-images-crop
Crop for satellite images
- Loading branch information
Showing
6 changed files
with
62 additions
and
47 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import cv2 | ||
|
||
from typing import Tuple | ||
|
||
from aero_vloc.geo_referencers.geo_referencer import GeoReferencer | ||
from aero_vloc.primitives import MapTile | ||
from aero_vloc.utils import get_new_size | ||
|
||
|
||
class LinearReferencer(GeoReferencer): | ||
def get_lat_lon( | ||
self, map_tile: MapTile, pixel: Tuple[int, int], resize: int | ||
) -> Tuple[float, float]: | ||
lat = map_tile.top_left_lat + (abs(pixel[1]) / resize) * ( | ||
map_image = cv2.imread(str(map_tile.path)) | ||
h_new, w_new = get_new_size(*map_image.shape[:2], resize) | ||
|
||
lat = map_tile.top_left_lat + (abs(pixel[1]) / h_new) * ( | ||
map_tile.bottom_right_lat - map_tile.top_left_lat | ||
) | ||
lon = map_tile.top_left_lon + (abs(pixel[0]) / resize) * ( | ||
lon = map_tile.top_left_lon + (abs(pixel[0]) / w_new) * ( | ||
map_tile.bottom_right_lon - map_tile.top_left_lon | ||
) | ||
return lat, lon |
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
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
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
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