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
path: root/extern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-02-27 12:27:30 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-02-27 12:31:09 +0400
commit00acb984360439d5480bd84d5a212a5524984900 (patch)
tree48d30e7a821ea40763fb1ff56aea3334c46b137e /extern
parent64eea27533b84a271ad66ea27b937c4b8096f14e (diff)
Fix T38844: Crash if weight track = 0
Avoid zero-sized problem when doing euclidean intersection Zero-sized problem might occur when intersecting track with constant zero weight. For such tracks we'll just use result of algebraic intersection. TODO: We probably need to have a separate BA step to adjust positions of tracks with constant zero weight.
Diffstat (limited to 'extern')
-rw-r--r--extern/libmv/libmv/simple_pipeline/intersect.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/extern/libmv/libmv/simple_pipeline/intersect.cc b/extern/libmv/libmv/simple_pipeline/intersect.cc
index 6a098da272d..ddb713684a4 100644
--- a/extern/libmv/libmv/simple_pipeline/intersect.cc
+++ b/extern/libmv/libmv/simple_pipeline/intersect.cc
@@ -100,6 +100,8 @@ bool EuclideanIntersect(const vector<Marker> &markers,
ceres::Problem problem;
+ // Add residual blocks to the problem.
+ int num_residuals = 0;
for (int i = 0; i < markers.size(); ++i) {
const Marker &marker = markers[i];
if (marker.weight != 0.0) {
@@ -113,9 +115,27 @@ bool EuclideanIntersect(const vector<Marker> &markers,
3>(new EuclideanIntersectCostFunctor(marker, camera)),
NULL,
&X(0));
+ num_residuals++;
}
}
+ // TODO(sergey): Once we'll update Ceres to the next version
+ // we wouldn't need this check anymore -- Ceres will deal with
+ // zero-sized problems nicely.
+ LG << "Number of residuals: " << num_residuals;
+ if (!num_residuals) {
+ LG << "Skipping running minimizer with zero residuals";
+
+ // We still add 3D point for the track regardless it was
+ // optimized or not. If track is a constant zero it'll use
+ // algebraic intersection result as a 3D coordinate.
+
+ Vec3 point = X.head<3>();
+ reconstruction->InsertPoint(markers[0].track, point);
+
+ return true;
+ }
+
// Configure the solve.
ceres::Solver::Options solver_options;
solver_options.linear_solver_type = ceres::DENSE_QR;