[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54933] trunk/blender/extern/libmv: Remove unused rigid registration code
Sergey Sharybin
sergey.vfx at gmail.com
Thu Feb 28 15:24:52 CET 2013
Revision: 54933
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54933
Author: nazgul
Date: 2013-02-28 14:24:52 +0000 (Thu, 28 Feb 2013)
Log Message:
-----------
Remove unused rigid registration code
There're some features planned which would
require rigid registration, but this code
would need to be re-done anyway to use new
minimizer and solving some issues with ICP
algorithm there.
Modified Paths:
--------------
trunk/blender/extern/libmv/CMakeLists.txt
trunk/blender/extern/libmv/files.txt
trunk/blender/extern/libmv/libmv-capi.cpp
Removed Paths:
-------------
trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.cc
trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.h
Modified: trunk/blender/extern/libmv/CMakeLists.txt
===================================================================
--- trunk/blender/extern/libmv/CMakeLists.txt 2013-02-28 14:24:42 UTC (rev 54932)
+++ trunk/blender/extern/libmv/CMakeLists.txt 2013-02-28 14:24:52 UTC (rev 54933)
@@ -59,7 +59,6 @@
libmv/simple_pipeline/pipeline.cc
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/resect.cc
- libmv/simple_pipeline/rigid_registration.cc
libmv/simple_pipeline/tracks.cc
libmv/tracking/brute_region_tracker.cc
libmv/tracking/esm_region_tracker.cc
@@ -118,7 +117,6 @@
libmv/simple_pipeline/pipeline.h
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/resect.h
- libmv/simple_pipeline/rigid_registration.h
libmv/simple_pipeline/tracks.h
libmv/tracking/brute_region_tracker.h
libmv/tracking/esm_region_tracker.h
Modified: trunk/blender/extern/libmv/files.txt
===================================================================
--- trunk/blender/extern/libmv/files.txt 2013-02-28 14:24:42 UTC (rev 54932)
+++ trunk/blender/extern/libmv/files.txt 2013-02-28 14:24:52 UTC (rev 54933)
@@ -54,8 +54,6 @@
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/resect.cc
libmv/simple_pipeline/resect.h
-libmv/simple_pipeline/rigid_registration.cc
-libmv/simple_pipeline/rigid_registration.h
libmv/simple_pipeline/tracks.cc
libmv/simple_pipeline/tracks.h
libmv/tracking/brute_region_tracker.cc
Deleted: trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.cc
===================================================================
--- trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.cc 2013-02-28 14:24:42 UTC (rev 54932)
+++ trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.cc 2013-02-28 14:24:52 UTC (rev 54933)
@@ -1,182 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#include "libmv/simple_pipeline/rigid_registration.h"
-#include "libmv/numeric/levenberg_marquardt.h"
-
-namespace libmv {
-
-template<class RigidTransformation>
-struct RigidRegistrationCostFunction {
- public:
- typedef Vec FMatrixType;
- typedef RigidTransformation XMatrixType;
-
- RigidRegistrationCostFunction(const vector<Vec3> &reference_points,
- const vector<Vec3> &points):
- reference_points_(reference_points),
- points_(points) {}
-
- Vec CalculateResiduals(const Mat3 &R,
- const Vec3 &S,
- const Vec3 &t) const {
- Vec residuals(points_.size());
- residuals.setZero();
-
- // Convert scale vector to matrix
- Mat3 SMat = Mat3::Identity();
- SMat(0, 0) *= S(0);
- SMat(1, 1) *= S(1);
- SMat(2, 2) *= S(2);
-
- for (int i = 0; i < points_.size(); i++) {
- Vec3 transformed_point = R * SMat * points_[i] + t;
-
- double norm = (transformed_point - reference_points_[i]).norm();
-
- residuals(i) = norm * norm;
- }
-
- return residuals;
- }
-
- Vec operator()(const Vec9 &RSt) const {
- Mat3 R = RotationFromEulerVector(RSt.head<3>());
- Vec3 S = RSt.segment<3>(3);
- Vec3 t = RSt.tail<3>();
-
- return CalculateResiduals(R, S, t);
- }
-
- Vec operator()(const Vec3 &euler) const {
- Mat3 R = RotationFromEulerVector(euler);
-
- return CalculateResiduals(R, Vec3(1.0, 1.0, 1.0), Vec3::Zero());
- }
-
- Vec operator()(const Vec6 &Rt) const {
- Mat3 R = RotationFromEulerVector(Rt.head<3>());
- Vec3 t = Rt.tail<3>();
-
- return CalculateResiduals(R, Vec3(1.0, 1.0, 1.0), t);
- }
-
- private:
- vector<Vec3> reference_points_;
- vector<Vec3> points_;
-};
-
-static double RigidRegistrationError(const vector<Vec3> &reference_points,
- const vector<Vec3> &points,
- const Mat3 &R,
- const Vec3 &S,
- const Vec3 &t) {
- double error = 0.0;
-
- Mat3 SMat = Mat3::Identity();
- SMat(0, 0) *= S(0);
- SMat(1, 1) *= S(1);
- SMat(2, 2) *= S(2);
-
- for (int i = 0; i < points.size(); i++) {
- Vec3 new_point = R * SMat * points[i] + t;
-
- double norm = (new_point - reference_points[i]).norm();
- error += norm * norm;
- }
- error /= points.size();
-
- return error;
-}
-
-double RigidRegistration(const vector<Vec3> &reference_points,
- const vector<Vec3> &points,
- Mat3 &R,
- Vec3 &S,
- Vec3 &t) {
- typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec9> > Solver;
-
- RigidRegistrationCostFunction<Vec9> rigidregistration_cost(reference_points, points);
- Solver solver(rigidregistration_cost);
-
- Vec9 RSt = Vec9::Zero();
-
- RSt(3) = RSt(4) = RSt(5) = 1.0;
-
- Solver::SolverParameters params;
- /*Solver::Results results = */ solver.minimize(params, &RSt);
- /* TODO(sergey): better error handling here */
-
- LG << "Rigid registration completed, rotation is:" << RSt.head<3>().transpose()
- << ", scale is " << RSt.segment<3>(3).transpose()
- << ", translation is " << RSt.tail<3>().transpose();
-
- // Decompose individual rotation and translation
- R = RotationFromEulerVector(RSt.head<3>());
- S = RSt.segment<3>(3);
- t = RSt.tail<3>();
-
- return RigidRegistrationError(reference_points, points, R, S, t);
-}
-
-double RigidRegistration(const vector<Vec3> &reference_points,
- const vector<Vec3> &points,
- Mat3 &R,
- Vec3 &t) {
- typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec6> > Solver;
-
- RigidRegistrationCostFunction<Vec6> rigidregistration_cost(reference_points, points);
- Solver solver(rigidregistration_cost);
-
- Vec6 Rt = Vec6::Zero();
- Solver::SolverParameters params;
- /*Solver::Results results = */solver.minimize(params, &Rt);
- /* TODO(sergey): better error handling here */
-
- LG << "Rigid registration completed, rotation is:" << Rt.head<3>().transpose()
- << ", translation is " << Rt.tail<3>().transpose();
-
- R = RotationFromEulerVector(Rt.head<3>());
- t = Rt.tail<3>();
-
- return RigidRegistrationError(reference_points, points, R, Vec3(1.0, 1.0, 1.0), t);
-}
-
-double RigidRegistration(const vector<Vec3> &reference_points,
- const vector<Vec3> &points,
- Mat3 &R) {
- typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec3> > Solver;
-
- RigidRegistrationCostFunction<Vec3> rigidregistration_cost(reference_points, points);
- Solver solver(rigidregistration_cost);
-
- Vec3 euler = Vec3::Zero();
- Solver::SolverParameters params;
- /*Solver::Results results = */solver.minimize(params, &euler);
- /* TODO(sergey): better error handling here */
-
- LG << "Rigid registration completed, rotation is:" << euler.transpose();
-
- R = RotationFromEulerVector(euler);
-
- return RigidRegistrationError(reference_points, points, R, Vec3(1.0, 1.0, 1.0), Vec3::Zero());
-}
-
-} // namespace libmv
Deleted: trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.h
===================================================================
--- trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.h 2013-02-28 14:24:42 UTC (rev 54932)
+++ trunk/blender/extern/libmv/libmv/simple_pipeline/rigid_registration.h 2013-02-28 14:24:52 UTC (rev 54933)
@@ -1,68 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#ifndef LIBMV_SIMPLE_PIPELINE_RIGID_REGISTRATION_H_
-#define LIBMV_SIMPLE_PIPELINE_RIGID_REGISTRATION_H_
-
-#include "libmv/base/vector.h"
-#include "libmv/numeric/numeric.h"
-
-namespace libmv {
-
-/*!
- Searched for an affine transformation of rigid 3D object defined by it's
- vertices positions from it's current state called points to it's desired
- state called reference points.
-
- Returns rotation matrix, per-component scale vector and translation which
- transforms points to the mot close state to reference_points.
-
- Return value is an average squared distance between reference state
- and transformed one.
-
- Minimzation of distance between point pairs is used to register such a
- rigid transformation and algorithm assumes that pairs of points are
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list