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>2013-10-15 19:21:41 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-15 19:21:41 +0400
commiteb69cb7de343843880809f25457c0cb1698dffde (patch)
tree80a8d8602297e67181cab451bb55e85ac0d323a1 /extern/libmv
parenteaf0d267f219d58afb91818c28305ef889dc3dbf (diff)
Get rid of Allow Fallback option
It was rather confusing from the user usage point of view and didn't get so much improvement after new bundle adjuster was added. In the future we might want to switch resection to PPnP algorithm, which could also might be a nice alternative to fallback option.
Diffstat (limited to 'extern/libmv')
-rw-r--r--extern/libmv/libmv-capi.cc11
-rw-r--r--extern/libmv/libmv-capi.h3
-rw-r--r--extern/libmv/libmv/multiview/euclidean_resection.cc26
-rw-r--r--extern/libmv/libmv/multiview/euclidean_resection.h9
-rw-r--r--extern/libmv/libmv/simple_pipeline/pipeline.cc26
-rw-r--r--extern/libmv/libmv/simple_pipeline/pipeline.h10
-rw-r--r--extern/libmv/libmv/simple_pipeline/reconstruction.h11
-rw-r--r--extern/libmv/libmv/simple_pipeline/resect.cc17
-rw-r--r--extern/libmv/libmv/simple_pipeline/resect.h6
9 files changed, 27 insertions, 92 deletions
diff --git a/extern/libmv/libmv-capi.cc b/extern/libmv/libmv-capi.cc
index 11608318a40..91a3b845815 100644
--- a/extern/libmv/libmv-capi.cc
+++ b/extern/libmv/libmv-capi.cc
@@ -498,7 +498,6 @@ static bool selectTwoKeyframesBasedOnGRICAndVariance(
libmv::Tracks &tracks,
libmv::Tracks &normalized_tracks,
libmv::CameraIntrinsics &camera_intrinsics,
- libmv::ReconstructionOptions &reconstruction_options,
int &keyframe1,
int &keyframe2)
{
@@ -542,8 +541,7 @@ static bool selectTwoKeyframesBasedOnGRICAndVariance(
/* get a solution from two keyframes only */
libmv::EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction);
libmv::EuclideanBundle(keyframe_tracks, &reconstruction);
- libmv::EuclideanCompleteReconstruction(reconstruction_options,
- keyframe_tracks,
+ libmv::EuclideanCompleteReconstruction(keyframe_tracks,
&reconstruction, NULL);
double current_error =
@@ -585,10 +583,6 @@ struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks
/* Retrieve reconstruction options from C-API to libmv API */
cameraIntrinsicsFromOptions(libmv_camera_intrinsics_options, &camera_intrinsics);
- libmv::ReconstructionOptions reconstruction_options;
- reconstruction_options.success_threshold = libmv_reconstruction_options->success_threshold;
- reconstruction_options.use_fallback_reconstruction = libmv_reconstruction_options->use_fallback_reconstruction;
-
/* Invert the camera intrinsics */
libmv::Tracks normalized_tracks = getNormalizedTracks(tracks, camera_intrinsics);
@@ -604,7 +598,6 @@ struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks
selectTwoKeyframesBasedOnGRICAndVariance(tracks,
normalized_tracks,
camera_intrinsics,
- reconstruction_options,
keyframe1,
keyframe2);
@@ -625,7 +618,7 @@ struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks
libmv::EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction);
libmv::EuclideanBundle(normalized_tracks, &reconstruction);
- libmv::EuclideanCompleteReconstruction(reconstruction_options, normalized_tracks,
+ libmv::EuclideanCompleteReconstruction(normalized_tracks,
&reconstruction, &update_callback);
/* refinement */
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index a872eeb60a1..9541f411ba0 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -94,9 +94,6 @@ typedef struct libmv_ReconstructionOptions {
int keyframe1, keyframe2;
int refine_intrinsics;
-
- double success_threshold;
- int use_fallback_reconstruction;
} libmv_ReconstructionOptions;
typedef void (*reconstruct_progress_update_cb) (void *customdata, double progress, const char *message);
diff --git a/extern/libmv/libmv/multiview/euclidean_resection.cc b/extern/libmv/libmv/multiview/euclidean_resection.cc
index d5421b9691e..b8c0a56005e 100644
--- a/extern/libmv/libmv/multiview/euclidean_resection.cc
+++ b/extern/libmv/libmv/multiview/euclidean_resection.cc
@@ -37,23 +37,21 @@ typedef unsigned int uint;
bool EuclideanResectionPPnP(const Mat2X &x_camera,
const Mat3X &X_world,
- Mat3 *R, Vec3 *t,
- double tolerance);
+ Mat3 *R, Vec3 *t);
bool EuclideanResection(const Mat2X &x_camera,
const Mat3X &X_world,
Mat3 *R, Vec3 *t,
- ResectionMethod method,
- double success_threshold) {
+ ResectionMethod method) {
switch (method) {
case RESECTION_ANSAR_DANIILIDIS:
EuclideanResectionAnsarDaniilidis(x_camera, X_world, R, t);
break;
case RESECTION_EPNP:
- return EuclideanResectionEPnP(x_camera, X_world, R, t, success_threshold);
+ return EuclideanResectionEPnP(x_camera, X_world, R, t);
break;
case RESECTION_PPNP:
- return EuclideanResectionPPnP(x_camera, X_world, R, t, success_threshold);
+ return EuclideanResectionPPnP(x_camera, X_world, R, t);
break;
default:
LOG(FATAL) << "Unknown resection method.";
@@ -444,8 +442,7 @@ static void ComputePointsCoordinatesInCameraFrame(
bool EuclideanResectionEPnP(const Mat2X &x_camera,
const Mat3X &X_world,
- Mat3 *R, Vec3 *t,
- double success_threshold) {
+ Mat3 *R, Vec3 *t) {
CHECK(x_camera.cols() == X_world.cols());
CHECK(x_camera.cols() > 3);
size_t num_points = X_world.cols();
@@ -553,13 +550,7 @@ bool EuclideanResectionEPnP(const Mat2X &x_camera,
//
// TODO(keir): Decide if setting this to infinity, effectively disabling the
// check, is the right approach. So far this seems the case.
- //
- // TODO(sergey): Made it an option for now, in some cases it makes sense to
- // still fallback to reprojection solution
- // For details see bug [#32765] from Blender bug tracker
-
- // double kSuccessThreshold = std::numeric_limits<double>::max();
- double kSuccessThreshold = success_threshold;
+ double kSuccessThreshold = std::numeric_limits<double>::max();
// Find the first possible solution for R, t corresponding to:
// Betas = [b00 b01 b11 b02 b12 b22 b03 b13 b23 b33]
@@ -728,8 +719,7 @@ bool EuclideanResectionEPnP(const Mat2X &x_camera,
// other hand, it did work on the first try.
bool EuclideanResectionPPnP(const Mat2X &x_camera,
const Mat3X &X_world,
- Mat3 *R, Vec3 *t,
- double tolerance) {
+ Mat3 *R, Vec3 *t) {
int n = x_camera.cols();
Mat Z = Mat::Zero(n, n);
Vec e = Vec::Ones(n);
@@ -750,7 +740,7 @@ bool EuclideanResectionPPnP(const Mat2X &x_camera,
Mat E(n, 3);
int iteration = 0;
- tolerance = 1e-5;
+ double tolerance = 1e-5;
// TODO(keir): The limit of 100 can probably be reduced, but this will require
// some investigation.
while (error > tolerance && iteration < 100) {
diff --git a/extern/libmv/libmv/multiview/euclidean_resection.h b/extern/libmv/libmv/multiview/euclidean_resection.h
index ff9bccdd5c9..8a34f471df9 100644
--- a/extern/libmv/libmv/multiview/euclidean_resection.h
+++ b/extern/libmv/libmv/multiview/euclidean_resection.h
@@ -49,14 +49,11 @@ enum ResectionMethod {
* \param R Solution for the camera rotation matrix
* \param t Solution for the camera translation vector
* \param method The resection method to use.
- * \param success_threshold Threshold of an error which is still considered a success
- * (currently used by EPnP algorithm only)
*/
bool EuclideanResection(const Mat2X &x_camera,
const Mat3X &X_world,
Mat3 *R, Vec3 *t,
- ResectionMethod method = RESECTION_EPNP,
- double success_threshold = 1e-3);
+ ResectionMethod method = RESECTION_EPNP);
/**
* Computes the extrinsic parameters, R and t for a calibrated camera
@@ -117,7 +114,6 @@ void EuclideanResectionAnsarDaniilidis(const Mat2X &x_camera,
* \param X_world 3D points in the world coordinate system
* \param R Solution for the camera rotation matrix
* \param t Solution for the camera translation vector
- * \param success_threshold Threshold of an error which is still considered a success
*
* This is the algorithm described in:
* "{EP$n$P: An Accurate $O(n)$ Solution to the P$n$P Problem", by V. Lepetit
@@ -126,8 +122,7 @@ void EuclideanResectionAnsarDaniilidis(const Mat2X &x_camera,
*/
bool EuclideanResectionEPnP(const Mat2X &x_camera,
const Mat3X &X_world,
- Mat3 *R, Vec3 *t,
- double success_threshold = 1e-3);
+ Mat3 *R, Vec3 *t);
} // namespace euclidean_resection
} // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.cc b/extern/libmv/libmv/simple_pipeline/pipeline.cc
index 20f82e43262..41dd3251f10 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.cc
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.cc
@@ -51,10 +51,9 @@ struct EuclideanPipelineRoutines {
EuclideanBundle(tracks, reconstruction);
}
- static bool Resect(const ReconstructionOptions &options,
- const vector<Marker> &markers,
+ static bool Resect(const vector<Marker> &markers,
EuclideanReconstruction *reconstruction, bool final_pass) {
- return EuclideanResect(options, markers, reconstruction, final_pass);
+ return EuclideanResect(markers, reconstruction, final_pass);
}
static bool Intersect(const vector<Marker> &markers,
@@ -90,10 +89,8 @@ struct ProjectivePipelineRoutines {
ProjectiveBundle(tracks, reconstruction);
}
- static bool Resect(const ReconstructionOptions &options,
- const vector<Marker> &markers,
+ static bool Resect(const vector<Marker> &markers,
ProjectiveReconstruction *reconstruction, bool final_pass) {
- (void) options; // Ignored.
(void) final_pass; // Ignored.
return ProjectiveResect(markers, reconstruction);
@@ -144,7 +141,6 @@ static void CompleteReconstructionLogProgress(
template<typename PipelineRoutines>
void InternalCompleteReconstruction(
- const ReconstructionOptions &options,
const Tracks &tracks,
typename PipelineRoutines::Reconstruction *reconstruction,
ProgressUpdateCallback *update_callback = NULL) {
@@ -217,7 +213,7 @@ void InternalCompleteReconstruction(
if (reconstructed_markers.size() >= 5) {
CompleteReconstructionLogProgress(update_callback,
(double)tot_resects/(max_image));
- if (PipelineRoutines::Resect(options, reconstructed_markers,
+ if (PipelineRoutines::Resect(reconstructed_markers,
reconstruction, false)) {
num_resects++;
tot_resects++;
@@ -254,7 +250,7 @@ void InternalCompleteReconstruction(
if (reconstructed_markers.size() >= 5) {
CompleteReconstructionLogProgress(update_callback,
(double)tot_resects/(max_image));
- if (PipelineRoutines::Resect(options, reconstructed_markers,
+ if (PipelineRoutines::Resect(reconstructed_markers,
reconstruction, true)) {
num_resects++;
LG << "Ran final Resect() for image " << image;
@@ -341,21 +337,17 @@ double ProjectiveReprojectionError(
intrinsics);
}
-void EuclideanCompleteReconstruction(const ReconstructionOptions &options,
- const Tracks &tracks,
+void EuclideanCompleteReconstruction(const Tracks &tracks,
EuclideanReconstruction *reconstruction,
ProgressUpdateCallback *update_callback) {
- InternalCompleteReconstruction<EuclideanPipelineRoutines>(options,
- tracks,
+ InternalCompleteReconstruction<EuclideanPipelineRoutines>(tracks,
reconstruction,
update_callback);
}
-void ProjectiveCompleteReconstruction(const ReconstructionOptions &options,
- const Tracks &tracks,
+void ProjectiveCompleteReconstruction(const Tracks &tracks,
ProjectiveReconstruction *reconstruction) {
- InternalCompleteReconstruction<ProjectivePipelineRoutines>(options,
- tracks,
+ InternalCompleteReconstruction<ProjectivePipelineRoutines>(tracks,
reconstruction);
}
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.h b/extern/libmv/libmv/simple_pipeline/pipeline.h
index d8489012b95..4d1bd00c51f 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.h
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.h
@@ -39,9 +39,6 @@ namespace libmv {
repeated until all points and cameras are estimated. Periodically, bundle
adjustment is run to ensure a quality reconstruction.
- \a options are used to define some specific befaviours based on settings
- see documentation for ReconstructionOptions
-
\a tracks should contain markers used in the reconstruction.
\a reconstruction should contain at least some 3D points or some estimated
cameras. The minimum number of cameras is two (with no 3D points) and the
@@ -50,7 +47,6 @@ namespace libmv {
\sa EuclideanResect, EuclideanIntersect, EuclideanBundle
*/
void EuclideanCompleteReconstruction(
- const ReconstructionOptions &options,
const Tracks &tracks,
EuclideanReconstruction *reconstruction,
ProgressUpdateCallback *update_callback = NULL);
@@ -68,9 +64,6 @@ void EuclideanCompleteReconstruction(
repeated until all points and cameras are estimated. Periodically, bundle
adjustment is run to ensure a quality reconstruction.
- \a options are used to define some specific befaviours based on settings
- see documentation for ReconstructionOptions
-
\a tracks should contain markers used in the reconstruction.
\a reconstruction should contain at least some 3D points or some estimated
cameras. The minimum number of cameras is two (with no 3D points) and the
@@ -78,8 +71,7 @@ void EuclideanCompleteReconstruction(
\sa ProjectiveResect, ProjectiveIntersect, ProjectiveBundle
*/
-void ProjectiveCompleteReconstruction(const ReconstructionOptions &options,
- const Tracks &tracks,
+void ProjectiveCompleteReconstruction(const Tracks &tracks,
ProjectiveReconstruction *reconstruction);
diff --git a/extern/libmv/libmv/simple_pipeline/reconstruction.h b/extern/libmv/libmv/simple_pipeline/reconstruction.h
index 1610029b9d2..947a0636476 100644
--- a/extern/libmv/libmv/simple_pipeline/reconstruction.h
+++ b/extern/libmv/libmv/simple_pipeline/reconstruction.h
@@ -26,17 +26,6 @@
namespace libmv {
-struct ReconstructionOptions {
- // threshold value of reconstruction error which is still considered successful
- // if reconstruction error bigger than this value, fallback reconstruction
- // algorithm would be used (if enabled)
- double success_threshold;
-
- // use fallback reconstruction algorithm in cases main reconstruction algorithm
- // failed to reconstruct
- bool use_fallback_reconstruction;
-};
-
/*!
A EuclideanCamera is the location and rotation of the camera viewing \a image.
diff --git a/extern/libmv/libmv/simple_pipeline/resect.cc b/extern/libmv/libmv/simple_pipeline/resect.cc
index 941c95cf237..e73fc44df2a 100644
--- a/extern/libmv/libmv/simple_pipeline/resect.cc
+++ b/extern/libmv/libmv/simple_pipeline/resect.cc
@@ -91,8 +91,7 @@ struct EuclideanResectCostFunction {
} // namespace
-bool EuclideanResect(const ReconstructionOptions &options,
- const vector<Marker> &markers,
+bool EuclideanResect(const vector<Marker> &markers,
EuclideanReconstruction *reconstruction, bool final_pass) {
if (markers.size() < 5) {
return false;
@@ -107,23 +106,15 @@ bool EuclideanResect(const ReconstructionOptions &options,
Mat3 R;
Vec3 t;
- double success_threshold = std::numeric_limits<double>::max();
-
- if (options.use_fallback_reconstruction)
- success_threshold = options.success_threshold;
-
if (0 || !euclidean_resection::EuclideanResection(
points_2d, points_3d, &R, &t,
- euclidean_resection::RESECTION_EPNP,
- success_threshold)) {
+ euclidean_resection::RESECTION_EPNP)) {
// printf("Resection for image %d failed\n", markers[0].image);
LG << "Resection for image " << markers[0].image << " failed;"
<< " trying fallback projective resection.";
- if (!options.use_fallback_reconstruction) {
- LG << "No fallback; failing resection for " << markers[0].image;
- return false;
- }
+ LG << "No fallback; failing resection for " << markers[0].image;
+ return false;
if (!final_pass) return false;
// Euclidean resection failed. Fall back to projective resection, which is
diff --git a/extern/libmv/libmv/simple_pipeline/resect.h b/extern/libmv/libmv/simple_pipeline/resect.h
index 47a6c6b60ea..7ca3237437e 100644
--- a/extern/libmv/libmv/simple_pipeline/resect.h
+++ b/extern/libmv/libmv/simple_pipeline/resect.h
@@ -35,9 +35,6 @@ namespace libmv {
reconstruction object, and solves for the pose and orientation of the
camera for that frame.
- \a options are used to define some specific befaviours based on settings
- see documentation for ReconstructionOptions
-
\a markers should contain \l Marker markers \endlink belonging to tracks
visible in the one frame to be resectioned. Each of the tracks associated
with the markers must have a corresponding reconstructed 3D position in the
@@ -54,8 +51,7 @@ namespace libmv {
\sa EuclideanIntersect, EuclideanReconstructTwoFrames
*/
-bool EuclideanResect(const ReconstructionOptions &options,
- const vector<Marker> &markers,
+bool EuclideanResect(const vector<Marker> &markers,
EuclideanReconstruction *reconstruction, bool final_pass);
/*!