Skip to content

Commit dc7c77a

Browse files
author
Yann N.
committed
feat: add OPK in the report
1 parent 7a18393 commit dc7c77a

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

opensfm/report.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515

1616
class Report:
17-
def __init__(self, data: DataSet) -> None:
18-
self.output_path: str = os.path.join(data.data_path, "stats")
19-
self.dataset_name: str = os.path.basename(data.data_path)
20-
self.io_handler: io.IoFilesystemBase = data.io_handler
17+
def __init__(self, data: DataSet, stats = None) -> None:
18+
self.output_path = os.path.join(data.data_path, "stats")
19+
self.dataset_name = os.path.basename(data.data_path)
20+
self.io_handler = data.io_handler
2121

2222
self.mapi_light_light_green = [255, 255, 255]
2323
self.mapi_light_green = [0, 0, 0]
@@ -190,7 +190,7 @@ def make_dataset_summary(self) -> None:
190190
[
191191
"Processing Time",
192192
#f"{self.stats['processing_statistics']['steps_times']['Total Time']:.2f} seconds",
193-
self.stats['odm_processing_statistics']['total_time_human'],
193+
self.stats['odm_processing_statistics']['total_time_human'] if 'odm_processing_statistics' in self.stats else f"{self.stats['processing_statistics']['steps_times']['Total Time']:.2f} seconds",
194194
],
195195
["Capture Start", self.stats["processing_statistics"]["start_date"]],
196196
["Capture End", self.stats["processing_statistics"]["end_date"]],
@@ -262,11 +262,12 @@ def make_processing_summary(self) -> None:
262262
])
263263

264264
# GSD (if available)
265-
if self.stats['odm_processing_statistics'].get('average_gsd'):
266-
rows.insert(3, [
267-
"Average Ground Sampling Distance (GSD)",
268-
f"{self.stats['odm_processing_statistics']['average_gsd']:.1f} cm"
269-
])
265+
if 'odm_processing_statistics' in self.stats:
266+
if self.stats['odm_processing_statistics'].get('average_gsd'):
267+
rows.insert(3, [
268+
"Average Ground Sampling Distance (GSD)",
269+
f"{self.stats['odm_processing_statistics']['average_gsd']:.1f} cm"
270+
])
270271

271272
row_gps_gcp = [" / ".join(geo_string) + " errors"]
272273
geo_errors = []
@@ -724,6 +725,7 @@ def generate_report(self) -> None:
724725
else:
725726
self.make_align_details()
726727

728+
self.make_orientation_details()
727729
self.add_page_break()
728730

729731
self.make_features_details()

opensfm/stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def td_errors(data: DataSetBase, tracks_manager, reconstructions):
211211
if len(ray_errors) > 0:
212212
errors.append((np.max(np.array(ray_errors), axis=0)))
213213

214-
return _gps_gcp_errors_stats(errors)
214+
return _gps_gcp_opk_errors_stats(errors, ["x", "y", "z"])
215215

216216

217217
def gps_errors(reconstructions: List[types.Reconstruction]) -> Dict[str, Any]:
@@ -317,7 +317,7 @@ def gcp_errors(
317317
with open(os.path.join(data.data_path, "stats", "ground_control_points.json"), 'w') as f:
318318
f.write(json.dumps(gcp_stats, indent=4))
319319

320-
return _gps_gcp_errors_stats(np.array(all_errors))
320+
return _gps_gcp_opk_errors_stats(np.array(all_errors), ["x", "y", "z"])
321321

322322

323323
def _compute_errors(

0 commit comments

Comments
 (0)