Skip to content

Commit

Permalink
added some more wrappers
Browse files Browse the repository at this point in the history
Change-Id: Iee59a9838af3c4c3d86670f8c7aeeecea6eb901a
  • Loading branch information
urbste committed Nov 28, 2023
1 parent a168b16 commit 69c3d37
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ opts.loss_function_type = pt.sfm.LossFunctionType.HUBER

res = BundleAdjustReconstruction(opts, recon)
res = BundleAdjustPartialReconstruction(opts, {view_ids}, {track_ids}, recon)
res = BundleAdjustPartialViewConstant(opts, {var_view_ids}, {const_view_ids}, recon)
res = BundleAdjustPartialViewsConstant(opts, {var_view_ids}, {const_view_ids}, recon)

# optimize absolute pose on normalized 2D 3D correspondences
res = pt.sfm.OptimizeAbsolutePoseOnNormFeatures(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create_package():

setuptools.setup(
name='pytheia',
version='0.2.0',
version='0.2.1',
description='A performant Structure from Motion library for Python',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down
22 changes: 18 additions & 4 deletions src/pytheia/sfm/sfm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1401,13 +1401,27 @@ void pytheia_sfm_classes(py::module& m) {
//&theia::Reconstruction::GetSubReconstructionWrapper)
;

// Reconstruction Estimator Helpers
m.def("SetUnderconstrainedTracksToUnestimated",
theia::SetUnderconstrainedTracksToUnestimated);
&theia::SetUnderconstrainedTracksToUnestimated);
m.def("SetUnderconstrainedViewsToUnestimated",
theia::SetUnderconstrainedViewsToUnestimated);

&theia::SetUnderconstrainedViewsToUnestimated);
m.def("NumEstimatedViews",
&theia::NumEstimatedViews);
m.def("NumEstimatedTracks",
&theia::NumEstimatedTracks);
m.def("SetReconstructionFromEstimatedPoses",
&theia::SetReconstructionFromEstimatedPoses);
m.def("CreateEstimatedSubreconstruction",
&theia::CreateEstimatedSubreconstruction);
m.def("RelativeRotationsFromViewGraph",
&theia::RelativeRotationsFromViewGraph);
m.def("GetEstimatedViewsFromReconstruction",
&theia::GetEstimatedViewsFromReconstructionWrapper);
m.def("GetEstimatedTracksFromReconstruction",
&theia::GetEstimatedTracksFromReconstructionWrapper);

// Reconstruction Estimator

// TwoViewInfo
py::class_<theia::TwoViewInfo>(m, "TwoViewInfo")
.def(py::init<>())
Expand Down
16 changes: 16 additions & 0 deletions src/theia/sfm/sfm_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,20 @@ int SetOutlierTracksToUnestimatedWrapper(
return num_features_rm;
}

// Outputs the ViewId of all estimated views in the reconstruction.
std::unordered_set<ViewId> GetEstimatedViewsFromReconstructionWrapper(
const Reconstruction& reconstruction) {
std::unordered_set<ViewId> estimated_views;
theia::GetEstimatedViewsFromReconstruction(reconstruction, &estimated_views);
return estimated_views;
}

// Outputs the TrackId of all estimated tracks in the reconstruction.
std::unordered_set<TrackId> GetEstimatedTracksFromReconstructionWrapper(
const Reconstruction& reconstruction) {
std::unordered_set<TrackId> estimated_tracks;
theia::GetEstimatedTracksFromReconstruction(reconstruction, &estimated_tracks);
return estimated_tracks;
}

} // namespace theia
9 changes: 9 additions & 0 deletions src/theia/sfm/sfm_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "theia/sfm/set_camera_intrinsics_from_priors.h"
#include "theia/sfm/set_outlier_tracks_to_unestimated.h"
#include "theia/sfm/undistort_image.h"
#include "theia/sfm/reconstruction_estimator_utils.h"

namespace theia {

Expand Down Expand Up @@ -43,4 +44,12 @@ int SetOutlierTracksToUnestimatedWrapper(
const double min_triangulation_angle_degrees,
Reconstruction& reconstruction);

// Outputs the ViewId of all estimated views in the reconstruction.
std::unordered_set<ViewId> GetEstimatedViewsFromReconstructionWrapper(
const Reconstruction& reconstruction);

// Outputs the TrackId of all estimated tracks in the reconstruction.
std::unordered_set<TrackId> GetEstimatedTracksFromReconstructionWrapper(
const Reconstruction& reconstruction);

} // namespace theia

0 comments on commit 69c3d37

Please sign in to comment.