Skip to content

Commit cdd0daf

Browse files
authored
Merge branch 'main' into remove-tracks
2 parents f99f2f5 + 47e3607 commit cdd0daf

241 files changed

Lines changed: 86470 additions & 1181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

annotation_gui_gcp/lib/GUI.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
from collections import defaultdict
88

99
import flask
10+
from opensfm import dataset
11+
1012
from .views.cad_view import CADView
1113
from .views.cp_finder_view import ControlPointFinderView
1214
from .views.image_view import ImageView
1315
from .views.tools_view import ToolsView
14-
from opensfm import dataset
1516

1617

1718
class Gui:

annotation_gui_gcp/lib/gcp_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __repr__(self):
7171

7272

7373
def observation_to_json(
74-
obs: t.Union[PointMeasurement3D, PointMeasurement]
74+
obs: t.Union[PointMeasurement3D, PointMeasurement],
7575
) -> t.Dict[str, t.Any]:
7676
if isinstance(obs, PointMeasurement):
7777
return {
@@ -90,7 +90,7 @@ def observation_to_json(
9090

9191

9292
def observation_from_json(
93-
obs: t.Dict[str, t.Any]
93+
obs: t.Dict[str, t.Any],
9494
) -> t.Union[PointMeasurement3D, PointMeasurement]:
9595
if "projection" in obs:
9696
return PointMeasurement(

annotation_gui_gcp/lib/geometry.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# pyre-unsafe
2-
from opensfm import dataset
3-
from numpy import ndarray
42
from typing import Dict, Tuple
53

4+
from numpy import ndarray
5+
from opensfm import dataset
6+
67

78
def get_all_track_observations(gcp_database, track_id: str) -> Dict[str, ndarray]:
89
print(f"Getting all observations of track {track_id}")
@@ -12,7 +13,9 @@ def get_all_track_observations(gcp_database, track_id: str) -> Dict[str, ndarray
1213
return {shot_id: obs.point for shot_id, obs in track_obs.items()}
1314

1415

15-
def get_tracks_visible_in_image(gcp_database, image_key, min_len: int=5) -> Dict[str, Tuple[ndarray, int]]:
16+
def get_tracks_visible_in_image(
17+
gcp_database, image_key, min_len: int = 5
18+
) -> Dict[str, Tuple[ndarray, int]]:
1619
print(f"Getting track observations visible in {image_key}")
1720
data = dataset.DataSet(gcp_database.path)
1821
tracks_manager = data.load_tracks_manager()

annotation_gui_gcp/lib/views/cad_view.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
from typing import Any, Dict, Tuple
66

77
import rasterio
8-
from ..views.web_view import WebView, distinct_colors
98
from flask import send_file
109
from PIL import ImageColor
1110

11+
from ..views.web_view import distinct_colors, WebView
12+
1213
logger: logging.Logger = logging.getLogger(__name__)
1314

1415

@@ -31,7 +32,7 @@ def __init__(
3132
route_prefix,
3233
path_cad_file,
3334
is_geo_reference=False,
34-
)-> None:
35+
) -> None:
3536
super().__init__(main_ui, web_app, route_prefix)
3637

3738
self.main_ui = main_ui
@@ -60,7 +61,7 @@ def process_client_message(self, data: Dict[str, Any]) -> None:
6061
else:
6162
raise ValueError(f"Unknown event {event}")
6263

63-
def add_remove_update_point_observation(self, point_coordinates=None)->None:
64+
def add_remove_update_point_observation(self, point_coordinates=None) -> None:
6465
gcp_manager = self.main_ui.gcp_manager
6566
active_gcp = self.main_ui.curr_point
6667
if active_gcp is None:
@@ -98,17 +99,17 @@ def add_remove_update_point_observation(self, point_coordinates=None)->None:
9899
def display_points(self) -> None:
99100
pass
100101

101-
def refocus(self, lat, lon)->None:
102+
def refocus(self, lat, lon) -> None:
102103
x, y, z = self.latlon_to_xyz(lat, lon)
103104
self.send_sse_message(
104105
{"x": x, "y": y, "z": z},
105106
event_type="move_camera",
106107
)
107108

108-
def highlight_gcp_reprojection(self, *args, **kwargs)->None:
109+
def highlight_gcp_reprojection(self, *args, **kwargs) -> None:
109110
pass
110111

111-
def populate_image_list(self, *args, **kwargs)->None:
112+
def populate_image_list(self, *args, **kwargs) -> None:
112113
pass
113114

114115
def latlon_to_xyz(self, lat, lon) -> Tuple[float, float, float]:
@@ -129,13 +130,13 @@ def xyz_to_latlon(self, x, y, z) -> Tuple[float, float, float]:
129130
lons, lats, alts = rasterio.warp.transform(self.crs, "EPSG:4326", [x], [y], [z])
130131
return lats[0], lons[0], alts[0]
131132

132-
def load_georeference_metadata(self, path_cad_model)->None:
133+
def load_georeference_metadata(self, path_cad_model) -> None:
133134
metadata = _load_georeference_metadata(path_cad_model)
134135
self.scale = metadata["scale"]
135136
self.crs = metadata["crs"]
136137
self.offset = metadata["offset"]
137138

138-
def sync_to_client(self)->None:
139+
def sync_to_client(self) -> None:
139140
"""
140141
Sends all the data required to initialize or sync the CAD view
141142
"""
@@ -152,7 +153,11 @@ def sync_to_client(self)->None:
152153
for point_id, coords in visible_points_coords.items():
153154
hex_color = distinct_colors[divmod(hash(point_id), 19)[1]]
154155
color = ImageColor.getrgb(hex_color)
155-
data["annotations"][point_id] = {"coordinates": coords[:-1], "precision": coords[-1], "color": color}
156+
data["annotations"][point_id] = {
157+
"coordinates": coords[:-1],
158+
"precision": coords[-1],
159+
"color": color,
160+
}
156161

157162
# Add the 3D reprojections of the points
158163
fn_reprojections = Path(

annotation_gui_gcp/lib/views/image_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pyre-unsafe
2-
from typing import Dict, Any
2+
from typing import Any, Dict
33

4-
from .web_view import WebView, distinct_colors
4+
from .web_view import distinct_colors, WebView
55

66

77
def point_color(point_id: str) -> str:

annotation_gui_gcp/lib/views/tools_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pyre-unsafe
2-
from typing import Dict, Any
2+
from typing import Any, Dict
33

44
from .web_view import WebView
55

annotation_gui_gcp/lib/views/web_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import time
55
from queue import Queue
66

7-
from flask import Response, jsonify, render_template, request
7+
from flask import jsonify, render_template, request, Response
88

99
distinct_colors = [
1010
"#46f0f0",

annotation_gui_gcp/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
import argparse
33
import json
44
import typing as t
5-
from collections import OrderedDict, defaultdict
5+
from collections import defaultdict, OrderedDict
66
from os import PathLike
77
from pathlib import Path
88
from typing import Union
99

1010
import numpy as np
11+
from flask import Flask
1112
from mapillary.opensfm.annotation_gui_gcp.lib import GUI
12-
from mapillary.opensfm.annotation_gui_gcp.lib.gcp_manager import GroundControlPointManager
13+
from mapillary.opensfm.annotation_gui_gcp.lib.gcp_manager import (
14+
GroundControlPointManager,
15+
)
1316
from mapillary.opensfm.annotation_gui_gcp.lib.image_manager import ImageManager
14-
from flask import Flask
1517
from opensfm import dataset, io
1618

1719

annotation_gui_gcp/run_ba.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,6 @@ def align(
739739
resplit = resplit_reconstruction(merged, reconstructions)
740740
data.save_reconstruction(resplit, fn_resplit)
741741
if covariance:
742-
743742
# Re-triangulate to remove badly conditioned points
744743
n_points = len(merged.points)
745744

bin/migrate_undistort.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
# Migrate dataset to the new undistort folder structure.
44

5-
if [ $# -le 0 ]
5+
if [ $# -le 0 ]
66
then
7-
echo "Migrate dataset to the new undistort folder structure."
7+
echo "Migrate dataset to the new undistort folder structure."
88
echo
9-
echo "Usage:"
9+
echo "Usage:"
1010
echo
1111
echo " $0 dataset"
1212
echo
13-
exit 1
14-
fi
13+
exit 1
14+
fi
1515

1616
cd $1
1717

0 commit comments

Comments
 (0)