Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions opensfm/actions/export_bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ def export_bundler(
if shot_id in shots:
shot = shots[shot_id]
camera = shot.camera
if shot.camera.projection_type == "brown":
# Will approximate Brown model, not optimal
focal_normalized = camera.focal_x
else:
focal_normalized = camera.focal
focal_normalized = camera.focal
scale = max(camera.width, camera.height)
focal = focal_normalized * scale
k1 = camera.k1
Expand Down
7 changes: 4 additions & 3 deletions opensfm/exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,10 @@ def camera_from_exif_metadata(
)
elif calib_pt == "brown":
camera = pygeometry.Camera.create_brown(
calib.get('focal_x', calib.get('focal')), calib.get('focal_y', calib.get('focal')) / calib.get('focal_x', calib.get('focal')),
np.array([calib.get('c_x', 0.0), calib.get('c_y', 0.0)]),
np.array([calib.get('k1', 0.0), calib.get('k2', 0.0), calib.get('k3', 0.0), calib.get('p1', 0.0), calib.get('p2', 0.0)])
calib["focal_x"],
calib["focal_y"] / calib["focal_x"],
np.array([calib["c_x"], calib["c_y"]]),
np.array([calib["k1"], calib["k2"], calib["k3"], calib["p1"], calib["p2"]]),
)
elif calib_pt == 'fisheye':
camera = pygeometry.Camera.create_fisheye(
Expand Down
7 changes: 4 additions & 3 deletions opensfm/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ def make_dataset_summary(self) -> None:
],
[
"Processing Time",
#f"{self.stats['processing_statistics']['steps_times']['Total Time']:.2f} seconds",
self.stats['odm_processing_statistics']['total_time_human'],
f"{self.stats['processing_statistics']['steps_times']['Total Time']:.2f} seconds",
],
["Capture Start", self.stats["processing_statistics"]["start_date"]],
["Capture End", self.stats["processing_statistics"]["end_date"]],
]
if self.stats.get('odm_processing_statistics') and self.stats['odm_processing_statistics'].get('total_time_human'):
rows[2][1] = self.stats['odm_processing_statistics']['total_time_human'],
self._make_table(None, rows, True)
self.pdf.set_xy(self.margin, self.pdf.get_y() + self.margin)

Expand Down Expand Up @@ -258,7 +259,7 @@ def make_processing_summary(self) -> None:
])

# GSD (if available)
if self.stats['odm_processing_statistics'].get('average_gsd'):
if self.stats.get('odm_processing_statistics') and self.stats['odm_processing_statistics'].get('average_gsd'):
rows.insert(3, [
"Average Ground Sampling Distance (GSD)",
f"{self.stats['odm_processing_statistics']['average_gsd']:.1f} cm"
Expand Down
5 changes: 5 additions & 0 deletions opensfm/src/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ target_link_libraries(pygeometry
foundation
pybind11
)

if (OPENSFM_BUILD_TESTS)
target_link_libraries(pygeometry PRIVATE ${GLOG_LIBRARY})
endif()

set_target_properties(pygeometry PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${opensfm_SOURCE_DIR}/.."
)
21 changes: 10 additions & 11 deletions opensfm/src/map/test/tracks_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,18 @@ TEST_F(TracksManagerTest, HasIOFileConsistency) {
::testing::WhenSorted(::testing::ElementsAre("1", "2", "3")));
EXPECT_THAT(manager_new.GetTrackIds(),
::testing::WhenSorted(::testing::ElementsAre("1")));
EXPECT_EQ(track, manager_new.GetTrackObservations("1"));
}

TEST_F(TracksManagerTest, HasIOStringConsistency) {
const auto serialized = manager.AsString();
const map::TracksManager manager_new =
map::TracksManager::InstanciateFromString(serialized);
std::unordered_map<map::ShotId, map::Observation> track_from_file = manager_new.GetTrackObservations("1");

EXPECT_THAT(manager_new.GetShotIds(),
::testing::WhenSorted(::testing::ElementsAre("1", "2", "3")));
EXPECT_THAT(manager_new.GetTrackIds(),
::testing::WhenSorted(::testing::ElementsAre("1")));
EXPECT_EQ(track, manager_new.GetTrackObservations("1"));
// Test that point, scale, color, and feature ID are correctly recovered from the file.
// Segmentation and instance IDs are not saved in the ODM file format. For this reason,
// track_from_file will not exactly match track (it is missing these fields).
for(auto const& it : track) {
EXPECT_EQ(it.second.point, track_from_file[it.first].point);
EXPECT_EQ(it.second.scale, track_from_file[it.first].scale);
EXPECT_EQ(it.second.color, track_from_file[it.first].color);
EXPECT_EQ(it.second.feature_id, track_from_file[it.first].feature_id);
}
}

} // namespace
4 changes: 2 additions & 2 deletions opensfm/test/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_processing_statistics_normal(

processing_statistics = stats.processing_statistics(dataset, [reference])

assert list(processing_statistics.keys()) == ["steps_times", "date", "area"]
assert list(processing_statistics.keys()) == ["steps_times", "date", "start_date", "end_date", "area"]
assert processing_statistics["steps_times"] == {
"Feature Extraction": -1,
"Features Matching": -1,
Expand All @@ -40,7 +40,7 @@ def test_processing_statistics_null(

processing_statistics = stats.processing_statistics(dataset, [null_scene])

assert list(processing_statistics.keys()) == ["steps_times", "date", "area"]
assert list(processing_statistics.keys()) == ["steps_times", "date", "start_date", "end_date", "area"]
assert processing_statistics["steps_times"] == {
"Feature Extraction": -1,
"Features Matching": -1,
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fpdf2==2.4.6
joblib==0.14.1
matplotlib
networkx==2.5
numpy
numpy==1.21.6
Pillow>=8.1.1
pyproj>=1.9.5.1
pytest==3.0.7
Expand All @@ -19,3 +19,6 @@ beautifulsoup4==4.9.1
lxml==4.5.1
wheel
opencv-python==4.5.1.48 ; sys_platform == "win32"
rasterio==1.3.11
rawpy==0.21.0
vmem==1.0.2
Loading