Berkeley SfM
normalization.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, The Regents of the University of California (Regents).
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer in the documentation and/or other materials provided
15  * with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Please contact the author(s) of this library if you have any questions.
34  * Authors: Erik Nelson ( eanelson@eecs.berkeley.edu )
35  * David Fridovich-Keil ( dfk@eecs.berkeley.edu )
36  */
37 
38 ///////////////////////////////////////////////////////////////////////////////
39 //
40 // This file defines functions used for feature normalization. In many geometry
41 // problems, 2D image coordinates require normalization (i.e. zero-mean
42 // coordinates, with an average distance of sqrt(2) from the origin). This is
43 // because the homogeneous coordinate is typically chosen as 1, and most cameras
44 // have resolutions ~ O(10^3). This is a big difference, leading to numerical
45 // precision errors in many algorithm implementations.
46 //
47 ///////////////////////////////////////////////////////////////////////////////
48 
49 #ifndef BSFM_GEOMETRY_NORMALIZATION_H
50 #define BSFM_GEOMETRY_NORMALIZATION_H
51 
52 #include <Eigen/Core>
53 #include "point_3d.h"
54 #include "../matching/feature.h"
55 #include "../matching/feature_match.h"
56 
57 namespace bsfm {
58 
59 using Eigen::Matrix3d;
60 using Eigen::Matrix4d;
61 using Eigen::MatrixXd;
62 
63 // Compute a matrix that when used to left-multiply the input features will
64 // normalize them. Since both sets of features are stored in the
65 // FeatureMatchList, the 'use_feature_set1' parameter must be specified to
66 // pick out a normalization for either feature set 1 or feature set 2.
67 Matrix3d ComputeNormalization(const FeatureMatchList& matched_features,
68  bool use_feature_set1);
69 
70 // Compute a matrix that when used to left-multiply the input features will
71 // normalize them.
72 Matrix3d ComputeNormalization(const FeatureList& features);
73 
74 // Compute a matrix that when used to left-multiply the input points will
75 // normalize them.
76 Matrix4d ComputeNormalization(const Point3DList& points);
77 
78 } //\namespace bsfm
79 
80 #endif
std::vector< Point3D > Point3DList
Definition: point_3d.h:100
Matrix3d ComputeNormalization(const FeatureMatchList &matched_features, bool use_feature_set1)
std::vector< Feature > FeatureList
Definition: feature.h:65
Definition: camera.cpp:50
std::vector< FeatureMatch > FeatureMatchList
Definition: feature_match.h:99