Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Readme missing information #3

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bc86520
Major refactor init
saihv Nov 8, 2017
cf54207
Added code to reconstruction module
saihv Nov 10, 2017
1ee4d4b
Removed old dependencies
saihv Nov 10, 2017
bf4af19
All in one test code: WIP
saihv Nov 13, 2017
796fef4
Updates to AIO file
saihv Nov 15, 2017
eb2d910
Fixed resectioning issue
saihv Nov 16, 2017
6fcb354
Initial barebones version
Dec 15, 2017
a49c8f7
Added data container, modifications
Dec 15, 2017
0c2b1e3
Detection, matching and relative pose complete
Dec 16, 2017
6b6f7d9
Restored unfactored code for map building
Dec 16, 2017
f530449
Reconstruction code WIP: need to fix unique_ptr issue
Dec 17, 2017
e1dca14
Added code for camera resection, fixed issue with residual computation
saihv Dec 29, 2017
df091e3
Enabled resection, fixed pointer data copy issue, other bugfixes
saihv Jan 2, 2018
38bf98e
Localization module WIP
saihv Jan 3, 2018
b446a50
Localizer WIP: Map setup complete
saihv Jan 4, 2018
0ef6bf9
Tentative full version of localization module
saihv Jan 4, 2018
56215ce
Localization module cleanup
saihv Jan 4, 2018
fb964b3
Pose refinement module : WIP
saihv Jan 5, 2018
093401c
Tentatively working refinement module
saihv Jan 5, 2018
6f2c25c
Made matching consistent between reconstruction and localization, add…
saihv Jan 11, 2018
647f927
Added utilities file, refactoring by moving some methods to utils
saihv Jan 11, 2018
c4ee70f
Added function to compare scale factors between two point clouds
saihv Jan 11, 2018
275aa95
Switched to AKAZE FLOAT, fixed localization bug
saihv Jan 12, 2018
886c6cd
Removed localization unit test
saihv Jan 12, 2018
9673271
Added Ceres parameter values, pose covariance computation block. Reve…
saihv Jan 13, 2018
2ca13cc
Refactoring, added bundle adjustment for scene, added plotting unit test
saihv Jan 14, 2018
1199096
Added functions to plot poses and scene
saihv Jan 14, 2018
f0b4f27
Removed plotting unit test, added OS-specific paths in cmakelists
saihv Jan 14, 2018
5066655
Added covariance plotting function
saihv Jan 14, 2018
ed26cfb
Main coloc method refactor
saihv Jan 14, 2018
66e0adb
Initial version of intra-pose estimation and covariance computation
saihv Jan 15, 2018
0b49368
Tested inter and intra estimation, added logging functions
saihv Jan 15, 2018
9f06752
Modifications, added unit test for map updates
saihv Jan 16, 2018
798df58
Working version of map updates (more testing needed), added homograph…
saihv Jan 17, 2018
90d7ed2
Removed unused files
saihv Jan 17, 2018
2225278
Refactoring WIP
saihv Jan 17, 2018
dac0f05
Refactoring near-complete, added map updating to main routines
saihv Jan 17, 2018
0cff01a
Bugfix in localization code
saihv Jan 19, 2018
eeca9e1
Added improvements suggested by Codacy
saihv Jan 19, 2018
304619d
Ensured relative localization happens only between two drones, added …
saihv Jan 23, 2018
bfb14ab
Bugfix in localization: added missing transformation of translation, …
saihv Jan 24, 2018
9eaaae5
Linked OpenCV libraries, added homography decomposition utilities and…
saihv Jan 25, 2018
b93cbcf
Added openMVG submodule
saihv Jan 25, 2018
65c9ae2
Intermediate commit
saihv Jan 29, 2018
c1e059c
Additions to uncertainty estimation
saihv Feb 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
build/
output/

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libraries/openMVG"]
path = libraries/openMVG
url = https://github.com/openMVG/openMVG
80 changes: 35 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,57 @@ else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

set(OpenMVG_DIR "/home/sai/software/installMVG/share/openMVG/cmake")
if(MSVC)
set(OpenMVG_DIR "D:/Code/Libraries/openMVG_install/share/openMVG/cmake")
set(OpenCV_DIR "D:/Code/Libraries/opencv-3.4.0/opencv-3.4.0/build/install_release")
set(PYTHON_LIBRARY "C:/Python27/libs/python27.lib")
set(PYTHON_INCLUDE_DIR "C:/Python27/include;C:/Python27/Lib/site-packages/numpy/core/include")
endif(MSVC)

find_package (OpenMVG REQUIRED)
find_package( Threads REQUIRED)
if(UNIX)
endif(UNIX)

find_package(OpenMVG REQUIRED)
find_package(Threads REQUIRED)
find_package(PythonLibs 3.6 REQUIRED)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP_FOUND)
find_package(OpenCV REQUIRED)

include_directories(
${OPENMVG_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${Eigen_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${OPENCV_INCLUDE_DIRS}
)

add_executable(lister src/ImageListing.cpp)
target_link_libraries(lister
openMVG_system
openMVG_image
openMVG_features
openMVG_sfm
easyexif)
file(
GLOB_RECURSE
coloc_headers
src/*.hpp
)
file(
GLOB_RECURSE
coloc_files
src/coloc.cpp
)

add_executable(detector src/ComputeFeatures.cpp)
target_link_libraries(detector
add_executable(coloc ${coloc_headers} ${coloc_files})
target_link_libraries(coloc
openMVG_system
openMVG_image
openMVG_features
openMVG_multiview
openMVG_sfm
stlplus
vlsift)

add_executable(matcher src/ComputeMatches.cpp)
target_link_libraries(matcher
openMVG_system
openMVG_features
openMVG_multiview
openMVG_sfm
openMVG_matching_image_collection
stlplus)

add_subdirectory(src/deps)

add_executable(reconstructor src/Reconstruct.cpp)
target_link_libraries(reconstructor
openMVG_system
openMVG_image
openMVG_features
openMVG_sfm
coloc_sfm
stlplus)

add_executable(localizer src/Localize.cpp)
target_link_libraries(localizer
openMVG_system
openMVG_image
openMVG_features
openMVG_matching_image_collection
openMVG_sfm
coloc_sfm
easyexif
vlsift)
openMVG_geometry
ceres
stlplus
easyexif
vlsift
${PYTHON_LIBRARIES}
${OpenCV_LIBS})
227 changes: 227 additions & 0 deletions ceres/autodiff_cost_function.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: [email protected] (Sameer Agarwal)
//
// Create CostFunctions as needed by the least squares framework, with
// Jacobians computed via automatic differentiation. For more
// information on automatic differentation, see the wikipedia article
// at http://en.wikipedia.org/wiki/Automatic_differentiation
//
// To get an auto differentiated cost function, you must define a class with a
// templated operator() (a functor) that computes the cost function in terms of
// the template parameter T. The autodiff framework substitutes appropriate
// "jet" objects for T in order to compute the derivative when necessary, but
// this is hidden, and you should write the function as if T were a scalar type
// (e.g. a double-precision floating point number).
//
// The function must write the computed value in the last argument
// (the only non-const one) and return true to indicate
// success. Please see cost_function.h for details on how the return
// value maybe used to impose simple constraints on the parameter
// block.
//
// For example, consider a scalar error e = k - x'y, where both x and y are
// two-dimensional column vector parameters, the prime sign indicates
// transposition, and k is a constant. The form of this error, which is the
// difference between a constant and an expression, is a common pattern in least
// squares problems. For example, the value x'y might be the model expectation
// for a series of measurements, where there is an instance of the cost function
// for each measurement k.
//
// The actual cost added to the total problem is e^2, or (k - x'k)^2; however,
// the squaring is implicitly done by the optimization framework.
//
// To write an auto-differentiable cost function for the above model, first
// define the object
//
// class MyScalarCostFunctor {
// MyScalarCostFunctor(double k): k_(k) {}
//
// template <typename T>
// bool operator()(const T* const x , const T* const y, T* e) const {
// e[0] = T(k_) - x[0] * y[0] + x[1] * y[1];
// return true;
// }
//
// private:
// double k_;
// };
//
// Note that in the declaration of operator() the input parameters x and y come
// first, and are passed as const pointers to arrays of T. If there were three
// input parameters, then the third input parameter would come after y. The
// output is always the last parameter, and is also a pointer to an array. In
// the example above, e is a scalar, so only e[0] is set.
//
// Then given this class definition, the auto differentiated cost function for
// it can be constructed as follows.
//
// CostFunction* cost_function
// = new AutoDiffCostFunction<MyScalarCostFunctor, 1, 2, 2>(
// new MyScalarCostFunctor(1.0)); ^ ^ ^
// | | |
// Dimension of residual -----+ | |
// Dimension of x ---------------+ |
// Dimension of y ------------------+
//
// In this example, there is usually an instance for each measumerent of k.
//
// In the instantiation above, the template parameters following
// "MyScalarCostFunctor", "1, 2, 2", describe the functor as computing a
// 1-dimensional output from two arguments, both 2-dimensional.
//
// AutoDiffCostFunction also supports cost functions with a
// runtime-determined number of residuals. For example:
//
// CostFunction* cost_function
// = new AutoDiffCostFunction<MyScalarCostFunctor, DYNAMIC, 2, 2>(
// new CostFunctorWithDynamicNumResiduals(1.0), ^ ^ ^
// runtime_number_of_residuals); <----+ | | |
// | | | |
// | | | |
// Actual number of residuals ------+ | | |
// Indicate dynamic number of residuals --------+ | |
// Dimension of x ------------------------------------+ |
// Dimension of y ---------------------------------------+
//
// The framework can currently accommodate cost functions of up to 10
// independent variables, and there is no limit on the dimensionality
// of each of them.
//
// WARNING #1: Since the functor will get instantiated with different types for
// T, you must to convert from other numeric types to T before mixing
// computations with other variables of type T. In the example above, this is
// seen where instead of using k_ directly, k_ is wrapped with T(k_).
//
// WARNING #2: A common beginner's error when first using autodiff cost
// functions is to get the sizing wrong. In particular, there is a tendency to
// set the template parameters to (dimension of residual, number of parameters)
// instead of passing a dimension parameter for *every parameter*. In the
// example above, that would be <MyScalarCostFunctor, 1, 2>, which is missing
// the last '2' argument. Please be careful when setting the size parameters.

#ifndef CERES_PUBLIC_AUTODIFF_COST_FUNCTION_H_
#define CERES_PUBLIC_AUTODIFF_COST_FUNCTION_H_

#include "third_party/ceres/internal/autodiff.h"
#include "third_party/ceres/internal/scoped_ptr.h"
#include "third_party/ceres/sized_cost_function.h"
#include "third_party/ceres/types.h"
#include "miniglog/glog/logging.h"

namespace ceres {

// A cost function which computes the derivative of the cost with respect to
// the parameters (a.k.a. the jacobian) using an autodifferentiation framework.
// The first template argument is the functor object, described in the header
// comment. The second argument is the dimension of the residual (or
// ceres::DYNAMIC to indicate it will be set at runtime), and subsequent
// arguments describe the size of the Nth parameter, one per parameter.
//
// The constructors take ownership of the cost functor.
//
// If the number of residuals (argument kNumResiduals below) is
// ceres::DYNAMIC, then the two-argument constructor must be used. The
// second constructor takes a number of residuals (in addition to the
// templated number of residuals). This allows for varying the number
// of residuals for a single autodiff cost function at runtime.
template <typename CostFunctor,
int kNumResiduals, // Number of residuals, or ceres::DYNAMIC.
int N0, // Number of parameters in block 0.
int N1 = 0, // Number of parameters in block 1.
int N2 = 0, // Number of parameters in block 2.
int N3 = 0, // Number of parameters in block 3.
int N4 = 0, // Number of parameters in block 4.
int N5 = 0, // Number of parameters in block 5.
int N6 = 0, // Number of parameters in block 6.
int N7 = 0, // Number of parameters in block 7.
int N8 = 0, // Number of parameters in block 8.
int N9 = 0> // Number of parameters in block 9.
class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9> {
public:
// Takes ownership of functor. Uses the template-provided value for the
// number of residuals ("kNumResiduals").
explicit AutoDiffCostFunction(CostFunctor* functor)
: functor_(functor) {
CHECK_NE(kNumResiduals, DYNAMIC)
<< "Can't run the fixed-size constructor if the "
<< "number of residuals is set to ceres::DYNAMIC.";
}

// Takes ownership of functor. Ignores the template-provided
// kNumResiduals in favor of the "num_residuals" argument provided.
//
// This allows for having autodiff cost functions which return varying
// numbers of residuals at runtime.
AutoDiffCostFunction(CostFunctor* functor, int num_residuals)
: functor_(functor) {
CHECK_EQ(kNumResiduals, DYNAMIC)
<< "Can't run the dynamic-size constructor if the "
<< "number of residuals is not ceres::DYNAMIC.";
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>
::set_num_residuals(num_residuals);
}

virtual ~AutoDiffCostFunction() {}

// Implementation details follow; clients of the autodiff cost function should
// not have to examine below here.
//
// To handle varardic cost functions, some template magic is needed. It's
// mostly hidden inside autodiff.h.
virtual bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const {
if (!jacobians) {
return internal::VariadicEvaluate<
CostFunctor, double, N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>
::Call(*functor_, parameters, residuals);
}
return internal::AutoDiff<CostFunctor, double,
N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>::Differentiate(
*functor_,
parameters,
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>::num_residuals(),
residuals,
jacobians);
}

private:
internal::scoped_ptr<CostFunctor> functor_;
};

} // namespace ceres

#endif // CERES_PUBLIC_AUTODIFF_COST_FUNCTION_H_
Loading