Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-04-20 12:19:47 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-04-20 17:26:32 +0300
commitce82e9e64a033c2ba0577316a203e2f4c892ed4b (patch)
treec981e3cbc971051f47fd1e1f8e1b284a3a3a1c0a /intern/libmv
parentc334020d8fe044aa286a96c307c3dde501731f5c (diff)
Libmv: Pass entire camera intrinsics to reprojection error functor
Currently no functional changes, but allows to have access to some invariant settings of camera intrinsics such as image dimensions.
Diffstat (limited to 'intern/libmv')
-rw-r--r--intern/libmv/libmv/simple_pipeline/bundle.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/intern/libmv/libmv/simple_pipeline/bundle.cc b/intern/libmv/libmv/simple_pipeline/bundle.cc
index 25e63b219d1..b7d1e1e57fb 100644
--- a/intern/libmv/libmv/simple_pipeline/bundle.cc
+++ b/intern/libmv/libmv/simple_pipeline/bundle.cc
@@ -72,11 +72,11 @@ namespace {
//
// This functor uses a radial distortion model.
struct OpenCVReprojectionError {
- OpenCVReprojectionError(const DistortionModelType distortion_model,
+ OpenCVReprojectionError(const CameraIntrinsics *invariant_intrinsics,
const double observed_x,
const double observed_y,
const double weight)
- : distortion_model_(distortion_model),
+ : invariant_intrinsics_(invariant_intrinsics),
observed_x_(observed_x), observed_y_(observed_y),
weight_(weight) {}
@@ -113,7 +113,7 @@ struct OpenCVReprojectionError {
// Apply distortion to the normalized points to get (xd, yd).
// TODO(keir): Do early bailouts for zero distortion; these are expensive
// jet operations.
- switch (distortion_model_) {
+ switch (invariant_intrinsics_->GetDistortionModelType()) {
case DISTORTION_MODEL_POLYNOMIAL:
{
const T& k1 = intrinsics[OFFSET_K1];
@@ -158,7 +158,7 @@ struct OpenCVReprojectionError {
return true;
}
- const DistortionModelType distortion_model_;
+ const CameraIntrinsics *invariant_intrinsics_;
const double observed_x_;
const double observed_y_;
const double weight_;
@@ -376,7 +376,7 @@ void EuclideanBundlerPerformEvaluation(const Tracks &tracks,
//
// At this point we only need to bundle points positions, cameras
// are to be totally still here.
-void EuclideanBundlePointsOnly(const DistortionModelType distortion_model,
+void EuclideanBundlePointsOnly(const CameraIntrinsics *invariant_intrinsics,
const vector<Marker> &markers,
vector<Vec6> &all_cameras_R_t,
double ceres_intrinsics[OFFSET_MAX],
@@ -399,7 +399,7 @@ void EuclideanBundlePointsOnly(const DistortionModelType distortion_model,
problem.AddResidualBlock(new ceres::AutoDiffCostFunction<
OpenCVReprojectionError, 2, OFFSET_MAX, 6, 3>(
new OpenCVReprojectionError(
- distortion_model,
+ invariant_intrinsics,
marker.x,
marker.y,
1.0)),
@@ -439,7 +439,6 @@ void EuclideanBundlePointsOnly(const DistortionModelType distortion_model,
ceres::Solve(options, &problem, &summary);
LG << "Final report:\n" << summary.FullReport();
-
}
} // namespace
@@ -520,7 +519,7 @@ void EuclideanBundleCommonIntrinsics(
problem.AddResidualBlock(new ceres::AutoDiffCostFunction<
OpenCVReprojectionError, 2, OFFSET_MAX, 6, 3>(
new OpenCVReprojectionError(
- intrinsics->GetDistortionModelType(),
+ intrinsics,
marker.x,
marker.y,
marker.weight)),
@@ -642,7 +641,7 @@ void EuclideanBundleCommonIntrinsics(
if (zero_weight_markers.size()) {
LG << "Refining position of constant zero-weighted tracks";
- EuclideanBundlePointsOnly(intrinsics->GetDistortionModelType(),
+ EuclideanBundlePointsOnly(intrinsics,
zero_weight_markers,
all_cameras_R_t,
ceres_intrinsics,