Skip to content

Commit 2dd22c6

Browse files
committed
Merge branch 'develop' into feature/wrap-multiple-interfaces
2 parents 6919ad9 + 740c9c6 commit 2dd22c6

File tree

98 files changed

+1324
-872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1324
-872
lines changed

gtsam/base/Matrix.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <gtsam/config.h>
3030

3131
#include <boost/format.hpp>
32-
#include <boost/function.hpp>
32+
#include <functional>
3333
#include <boost/tuple/tuple.hpp>
3434
#include <boost/math/special_functions/fpclassify.hpp>
3535

@@ -489,7 +489,7 @@ struct MultiplyWithInverseFunction {
489489

490490
// The function phi should calculate f(a)*b, with derivatives in a and b.
491491
// Naturally, the derivative in b is f(a).
492-
typedef boost::function<VectorN(
492+
typedef std::function<VectorN(
493493
const T&, const VectorN&, OptionalJacobian<N, M>, OptionalJacobian<N, N>)>
494494
Operator;
495495

gtsam/base/Testable.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
#pragma once
3535

3636
#include <boost/concept_check.hpp>
37-
#include <boost/shared_ptr.hpp>
37+
#include <functional>
3838
#include <iostream>
39+
#include <memory>
3940
#include <string>
4041

4142
#define GTSAM_PRINT(x)((x).print(#x))
@@ -119,10 +120,10 @@ namespace gtsam {
119120
* Binary predicate on shared pointers
120121
*/
121122
template<class V>
122-
struct equals_star : public std::function<bool(const boost::shared_ptr<V>&, const boost::shared_ptr<V>&)> {
123+
struct equals_star : public std::function<bool(const std::shared_ptr<V>&, const std::shared_ptr<V>&)> {
123124
double tol_;
124125
equals_star(double tol = 1e-9) : tol_(tol) {}
125-
bool operator()(const boost::shared_ptr<V>& expected, const boost::shared_ptr<V>& actual) {
126+
bool operator()(const std::shared_ptr<V>& expected, const std::shared_ptr<V>& actual) {
126127
if (!actual && !expected) return true;
127128
return actual && expected && traits<V>::Equals(*actual,*expected, tol_);
128129
}

gtsam/base/lieProxies.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* These should not be used outside of tests, as they are just remappings
2626
* of the original functions. We use these to avoid needing to do
27-
* too much boost::bind magic or writing a bunch of separate proxy functions.
27+
* too much std::bind magic or writing a bunch of separate proxy functions.
2828
*
2929
* Don't expect all classes to work for all of these functions.
3030
*/

gtsam/base/numericalDerivative.h

Lines changed: 172 additions & 173 deletions
Large diffs are not rendered by default.

gtsam/discrete/DecisionTree-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ namespace gtsam {
450450
template<typename L, typename Y>
451451
template<typename M, typename X>
452452
DecisionTree<L, Y>::DecisionTree(const DecisionTree<M, X>& other,
453-
const std::map<M, L>& map, boost::function<Y(const X&)> op) {
453+
const std::map<M, L>& map, std::function<Y(const X&)> op) {
454454
root_ = convert(other.root_, map, op);
455455
}
456456

@@ -568,7 +568,7 @@ namespace gtsam {
568568
template<typename M, typename X>
569569
typename DecisionTree<L, Y>::NodePtr DecisionTree<L, Y>::convert(
570570
const typename DecisionTree<M, X>::NodePtr& f, const std::map<M, L>& map,
571-
boost::function<Y(const X&)> op) {
571+
std::function<Y(const X&)> op) {
572572

573573
typedef DecisionTree<M, X> MX;
574574
typedef typename MX::Leaf MXLeaf;

gtsam/discrete/DecisionTree.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
#pragma once
2121

2222
#include <gtsam/discrete/Assignment.h>
23+
2324
#include <boost/function.hpp>
25+
#include <functional>
2426
#include <iostream>
25-
#include <vector>
2627
#include <map>
28+
#include <vector>
2729

2830
namespace gtsam {
2931

@@ -38,8 +40,8 @@ namespace gtsam {
3840
public:
3941

4042
/** Handy typedefs for unary and binary function types */
41-
typedef boost::function<Y(const Y&)> Unary;
42-
typedef boost::function<Y(const Y&, const Y&)> Binary;
43+
typedef std::function<Y(const Y&)> Unary;
44+
typedef std::function<Y(const Y&, const Y&)> Binary;
4345

4446
/** A label annotated with cardinality */
4547
typedef std::pair<L,size_t> LabelC;
@@ -107,7 +109,7 @@ namespace gtsam {
107109
/** Convert to a different type */
108110
template<typename M, typename X> NodePtr
109111
convert(const typename DecisionTree<M, X>::NodePtr& f, const std::map<M,
110-
L>& map, boost::function<Y(const X&)> op);
112+
L>& map, std::function<Y(const X&)> op);
111113

112114
/** Default constructor */
113115
DecisionTree();
@@ -143,7 +145,7 @@ namespace gtsam {
143145
/** Convert from a different type */
144146
template<typename M, typename X>
145147
DecisionTree(const DecisionTree<M, X>& other,
146-
const std::map<M, L>& map, boost::function<Y(const X&)> op);
148+
const std::map<M, L>& map, std::function<Y(const X&)> op);
147149

148150
/// @}
149151
/// @name Testable

gtsam/discrete/tests/testAlgebraicDecisionTree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void dot(const T&f, const string& filename) {
5454
}
5555

5656
/** I can't get this to work !
57-
class Mul: boost::function<double(const double&, const double&)> {
57+
class Mul: std::function<double(const double&, const double&)> {
5858
inline double operator()(const double& a, const double& b) {
5959
return a * b;
6060
}

gtsam/discrete/tests/testDecisionTree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ TEST(DT, conversion)
196196
map<string, Label> ordering;
197197
ordering[A] = X;
198198
ordering[B] = Y;
199-
boost::function<bool(const int&)> op = convert;
199+
std::function<bool(const int&)> op = convert;
200200
BDT f2(f1, ordering, op);
201201
// f1.print("f1");
202202
// f2.print("f2");

gtsam/geometry/Cal3Fisheye.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,21 @@ Point2 Cal3Fisheye::uncalibrate(const Point2& p, OptionalJacobian<2, 9> H1,
106106
/* ************************************************************************* */
107107
Point2 Cal3Fisheye::calibrate(const Point2& uv, OptionalJacobian<2, 9> Dcal,
108108
OptionalJacobian<2, 2> Dp) const {
109-
// initial gues just inverts the pinhole model
109+
// Apply inverse camera matrix to map the pixel coordinate (u, v)
110+
// of the equidistant fisheye image to angular coordinate space (xd, yd)
111+
// with radius theta given in radians.
110112
const double u = uv.x(), v = uv.y();
111113
const double yd = (v - v0_) / fy_;
112114
const double xd = (u - s_ * yd - u0_) / fx_;
113-
Point2 pi(xd, yd);
115+
const double theta = sqrt(xd * xd + yd * yd);
116+
117+
// Provide initial guess for the Gauss-Newton search.
118+
// The angular coordinates given by (xd, yd) are mapped back to
119+
// the focal plane of the perspective undistorted projection pi.
120+
// See Cal3Unified.calibrate() using the same pattern for the
121+
// undistortion of omnidirectional fisheye projection.
122+
const double scale = (theta > 0) ? tan(theta) / theta : 1.0;
123+
Point2 pi(scale * xd, scale * yd);
114124

115125
// Perform newtons method, break when solution converges past tol_,
116126
// throw exception if max iterations are reached

gtsam/geometry/Cyclic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
#include <gtsam/base/Group.h>
1919
#include <gtsam/base/Testable.h>
20-
#include <iostream> // for cout :-(
20+
21+
#include <cassert>
22+
#include <iostream> // for cout :-(
2123

2224
namespace gtsam {
2325

0 commit comments

Comments
 (0)