Skip to content

Commit 44add21

Browse files
author
Fabien Servant
committed
Remove useless files and functions
1 parent ba96d10 commit 44add21

File tree

8 files changed

+1
-716
lines changed

8 files changed

+1
-716
lines changed

src/aliceVision/camera/Equidistant.cpp

Lines changed: 0 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -67,203 +67,6 @@ Vec2 Equidistant::project(const Vec4& pt, bool applyDistortion) const
6767
return pt_ima;
6868
}
6969

70-
Eigen::Matrix<double, 2, 9> Equidistant::getDerivativeTransformProjectWrtRotation(const Eigen::Matrix4d& pose, const Vec4& pt) const
71-
{
72-
Eigen::Matrix4d T = pose;
73-
const Vec4 X = T * pt; // apply pose
74-
75-
const Eigen::Matrix<double, 3, 9> d_X_d_R = getJacobian_AB_wrt_A<3, 3, 1>(pose.block<3, 3>(0, 0), pt.head(3));
76-
77-
/* Compute angle with optical center */
78-
double len2d = sqrt(X(0) * X(0) + X(1) * X(1));
79-
Eigen::Matrix<double, 2, 2> d_len2d_d_X;
80-
d_len2d_d_X(0) = X(0) / len2d;
81-
d_len2d_d_X(1) = X(1) / len2d;
82-
83-
const double angle_Z = std::atan2(len2d, X(2));
84-
const double d_angle_Z_d_len2d = X(2) / (len2d * len2d + X(2) * X(2));
85-
86-
/* Ignore depth component and compute radial angle */
87-
const double angle_radial = std::atan2(X(1), X(0));
88-
89-
Eigen::Matrix<double, 2, 3> d_angles_d_X;
90-
d_angles_d_X(0, 0) = -X(1) / (X(0) * X(0) + X(1) * X(1));
91-
d_angles_d_X(0, 1) = X(0) / (X(0) * X(0) + X(1) * X(1));
92-
d_angles_d_X(0, 2) = 0.0;
93-
94-
d_angles_d_X(1, 0) = d_angle_Z_d_len2d * d_len2d_d_X(0);
95-
d_angles_d_X(1, 1) = d_angle_Z_d_len2d * d_len2d_d_X(1);
96-
d_angles_d_X(1, 2) = -len2d / (len2d * len2d + X(2) * X(2));
97-
98-
const double rsensor = std::min(sensorWidth(), sensorHeight());
99-
const double rscale = sensorWidth() / std::max(w(), h());
100-
const double fmm = _scale(0) * rscale;
101-
const double fov = rsensor / fmm;
102-
103-
const double radius = angle_Z / (0.5 * fov);
104-
105-
const double d_radius_d_angle_Z = 1.0 / (0.5 * fov);
106-
107-
/* radius = focal * angle_Z */
108-
const Vec2 P{cos(angle_radial) * radius, sin(angle_radial) * radius};
109-
110-
Eigen::Matrix<double, 2, 2> d_P_d_angles;
111-
d_P_d_angles(0, 0) = -sin(angle_radial) * radius;
112-
d_P_d_angles(0, 1) = cos(angle_radial) * d_radius_d_angle_Z;
113-
d_P_d_angles(1, 0) = cos(angle_radial) * radius;
114-
d_P_d_angles(1, 1) = sin(angle_radial) * d_radius_d_angle_Z;
115-
116-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_angles * d_angles_d_X * d_X_d_R;
117-
}
118-
119-
Eigen::Matrix<double, 2, 16> Equidistant::getDerivativeTransformProjectWrtPose(const Eigen::Matrix4d& pose, const Vec4& pt) const
120-
{
121-
Eigen::Matrix4d T = pose;
122-
const Vec4 X = T * pt; // apply pose
123-
124-
const Eigen::Matrix<double, 4, 16> d_X_d_T = getJacobian_AB_wrt_A<4, 4, 1>(T, pt);
125-
126-
/* Compute angle with optical center */
127-
double len2d = sqrt(X(0) * X(0) + X(1) * X(1));
128-
Eigen::Matrix<double, 2, 2> d_len2d_d_X;
129-
d_len2d_d_X(0) = X(0) / len2d;
130-
d_len2d_d_X(1) = X(1) / len2d;
131-
132-
const double angle_Z = std::atan2(len2d, X(2));
133-
const double d_angle_Z_d_len2d = X(2) / (len2d * len2d + X(2) * X(2));
134-
135-
/* Ignore depth component and compute radial angle */
136-
const double angle_radial = std::atan2(X(1), X(0));
137-
138-
Eigen::Matrix<double, 2, 3> d_angles_d_X;
139-
d_angles_d_X(0, 0) = -X(1) / (X(0) * X(0) + X(1) * X(1));
140-
d_angles_d_X(0, 1) = X(0) / (X(0) * X(0) + X(1) * X(1));
141-
d_angles_d_X(0, 2) = 0.0;
142-
143-
d_angles_d_X(1, 0) = d_angle_Z_d_len2d * d_len2d_d_X(0);
144-
d_angles_d_X(1, 1) = d_angle_Z_d_len2d * d_len2d_d_X(1);
145-
d_angles_d_X(1, 2) = -len2d / (len2d * len2d + X(2) * X(2));
146-
147-
const double rsensor = std::min(sensorWidth(), sensorHeight());
148-
const double rscale = sensorWidth() / std::max(w(), h());
149-
const double fmm = _scale(0) * rscale;
150-
const double fov = rsensor / fmm;
151-
152-
const double radius = angle_Z / (0.5 * fov);
153-
154-
const double d_radius_d_angle_Z = 1.0 / (0.5 * fov);
155-
156-
/* radius = focal * angle_Z */
157-
const Vec2 P{cos(angle_radial) * radius, sin(angle_radial) * radius};
158-
159-
Eigen::Matrix<double, 2, 2> d_P_d_angles;
160-
d_P_d_angles(0, 0) = -sin(angle_radial) * radius;
161-
d_P_d_angles(0, 1) = cos(angle_radial) * d_radius_d_angle_Z;
162-
d_P_d_angles(1, 0) = cos(angle_radial) * radius;
163-
d_P_d_angles(1, 1) = sin(angle_radial) * d_radius_d_angle_Z;
164-
165-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_angles * d_angles_d_X * d_X_d_T.block<3, 16>(0, 0);
166-
}
167-
168-
Eigen::Matrix<double, 2, 16> Equidistant::getDerivativeTransformProjectWrtPoseLeft(const Eigen::Matrix4d& pose, const Vec4& pt) const
169-
{
170-
Eigen::Matrix4d T = pose;
171-
const Vec4 X = T * pt; // apply pose
172-
173-
const Eigen::Matrix<double, 4, 16> d_X_d_T = getJacobian_AB_wrt_A<4, 4, 1>(Eigen::Matrix4d::Identity(), X);
174-
175-
/* Compute angle with optical center */
176-
double len2d = sqrt(X(0) * X(0) + X(1) * X(1));
177-
Eigen::Matrix<double, 2, 2> d_len2d_d_X;
178-
d_len2d_d_X(0) = X(0) / len2d;
179-
d_len2d_d_X(1) = X(1) / len2d;
180-
181-
const double angle_Z = std::atan2(len2d, X(2));
182-
const double d_angle_Z_d_len2d = X(2) / (len2d * len2d + X(2) * X(2));
183-
184-
/* Ignore depth component and compute radial angle */
185-
const double angle_radial = std::atan2(X(1), X(0));
186-
187-
Eigen::Matrix<double, 2, 3> d_angles_d_X;
188-
d_angles_d_X(0, 0) = -X(1) / (X(0) * X(0) + X(1) * X(1));
189-
d_angles_d_X(0, 1) = X(0) / (X(0) * X(0) + X(1) * X(1));
190-
d_angles_d_X(0, 2) = 0.0;
191-
192-
d_angles_d_X(1, 0) = d_angle_Z_d_len2d * d_len2d_d_X(0);
193-
d_angles_d_X(1, 1) = d_angle_Z_d_len2d * d_len2d_d_X(1);
194-
d_angles_d_X(1, 2) = -len2d / (len2d * len2d + X(2) * X(2));
195-
196-
const double rsensor = std::min(sensorWidth(), sensorHeight());
197-
const double rscale = sensorWidth() / std::max(w(), h());
198-
const double fmm = _scale(0) * rscale;
199-
const double fov = rsensor / fmm;
200-
201-
const double radius = angle_Z / (0.5 * fov);
202-
203-
const double d_radius_d_angle_Z = 1.0 / (0.5 * fov);
204-
205-
/* radius = focal * angle_Z */
206-
const Vec2 P{cos(angle_radial) * radius, sin(angle_radial) * radius};
207-
208-
Eigen::Matrix<double, 2, 2> d_P_d_angles;
209-
d_P_d_angles(0, 0) = -sin(angle_radial) * radius;
210-
d_P_d_angles(0, 1) = cos(angle_radial) * d_radius_d_angle_Z;
211-
d_P_d_angles(1, 0) = cos(angle_radial) * radius;
212-
d_P_d_angles(1, 1) = sin(angle_radial) * d_radius_d_angle_Z;
213-
214-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_angles * d_angles_d_X * d_X_d_T.block<3, 16>(0, 0);
215-
}
216-
217-
Eigen::Matrix<double, 2, 4> Equidistant::getDerivativeTransformProjectWrtPoint(const Eigen::Matrix4d& pose, const Vec4& pt) const
218-
{
219-
Eigen::Matrix4d T = pose;
220-
const Vec4 X = T * pt; // apply pose
221-
222-
const Eigen::Matrix4d& d_X_d_pt = T;
223-
224-
/* Compute angle with optical center */
225-
const double len2d = sqrt(X(0) * X(0) + X(1) * X(1));
226-
Eigen::Matrix<double, 2, 2> d_len2d_d_X;
227-
d_len2d_d_X(0) = X(0) / len2d;
228-
d_len2d_d_X(1) = X(1) / len2d;
229-
230-
const double angle_Z = std::atan2(len2d, X(2));
231-
const double d_angle_Z_d_len2d = X(2) / (len2d * len2d + X(2) * X(2));
232-
233-
/* Ignore depth component and compute radial angle */
234-
const double angle_radial = std::atan2(X(1), X(0));
235-
236-
Eigen::Matrix<double, 2, 4> d_angles_d_X;
237-
d_angles_d_X(0, 0) = -X(1) / (X(0) * X(0) + X(1) * X(1));
238-
d_angles_d_X(0, 1) = X(0) / (X(0) * X(0) + X(1) * X(1));
239-
d_angles_d_X(0, 2) = 0.0;
240-
d_angles_d_X(0, 3) = 0.0;
241-
242-
d_angles_d_X(1, 0) = d_angle_Z_d_len2d * d_len2d_d_X(0);
243-
d_angles_d_X(1, 1) = d_angle_Z_d_len2d * d_len2d_d_X(1);
244-
d_angles_d_X(1, 2) = -len2d / (len2d * len2d + X(2) * X(2));
245-
d_angles_d_X(1, 3) = 0.0;
246-
247-
const double rsensor = std::min(sensorWidth(), sensorHeight());
248-
const double rscale = sensorWidth() / std::max(w(), h());
249-
const double fmm = _scale(0) * rscale;
250-
const double fov = rsensor / fmm;
251-
const double radius = angle_Z / (0.5 * fov);
252-
253-
double d_radius_d_angle_Z = 1.0 / (0.5 * fov);
254-
255-
/* radius = focal * angle_Z */
256-
const Vec2 P{cos(angle_radial) * radius, sin(angle_radial) * radius};
257-
258-
Eigen::Matrix<double, 2, 2> d_P_d_angles;
259-
d_P_d_angles(0, 0) = -sin(angle_radial) * radius;
260-
d_P_d_angles(0, 1) = cos(angle_radial) * d_radius_d_angle_Z;
261-
d_P_d_angles(1, 0) = cos(angle_radial) * radius;
262-
d_P_d_angles(1, 1) = sin(angle_radial) * d_radius_d_angle_Z;
263-
264-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_angles * d_angles_d_X * d_X_d_pt;
265-
}
266-
26770
Eigen::Matrix<double, 2, 3> Equidistant::getDerivativeTransformProjectWrtPoint3(const Eigen::Matrix4d& T, const Vec4& pt) const
26871
{
26972
const Vec4 X = T * pt; // apply pose

src/aliceVision/camera/Equidistant.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@ class Equidistant : public IntrinsicScaleOffsetDisto
7676

7777
Vec2 project(const Vec4& pt, bool applyDistortion = true) const override;
7878

79-
Eigen::Matrix<double, 2, 9> getDerivativeTransformProjectWrtRotation(const Eigen::Matrix4d& pose, const Vec4& pt) const override;
80-
81-
Eigen::Matrix<double, 2, 16> getDerivativeTransformProjectWrtPose(const Eigen::Matrix4d& pose, const Vec4& pt) const override;
82-
83-
Eigen::Matrix<double, 2, 16> getDerivativeTransformProjectWrtPoseLeft(const Eigen::Matrix4d& pose, const Vec4& pt) const override;
84-
85-
Eigen::Matrix<double, 2, 4> getDerivativeTransformProjectWrtPoint(const Eigen::Matrix4d& pose, const Vec4& pt) const override;
86-
8779
Eigen::Matrix<double, 2, 3> getDerivativeTransformProjectWrtPoint3(const Eigen::Matrix4d& pose, const Vec4& pt) const override;
8880

8981
Eigen::Matrix<double, 2, 3> getDerivativeTransformProjectWrtDisto(const Eigen::Matrix4d& pose, const Vec4& pt) const;

src/aliceVision/camera/IntrinsicBase.hpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -136,38 +136,7 @@ class IntrinsicBase
136136

137137
Eigen::Matrix<double, 4, 3> getDerivativeCartesianfromSphericalCoordinates(const Vec3& pt);
138138

139-
/**
140-
* @brief Get the derivative of a projection of a 3D point into the camera plane
141-
* @param[in] pose The pose
142-
* @param[in] pt3D The 3D point
143-
* @return The projection jacobian with respect to the pose
144-
*/
145-
virtual Eigen::Matrix<double, 2, 16> getDerivativeTransformProjectWrtPose(const Eigen::Matrix4d& pose, const Vec4& pt3D) const = 0;
146-
147-
/**
148-
* @brief Get the derivative of a projection of a 3D point into the camera plane
149-
* @param[in] pose The pose
150-
* @param[in] pt3D The 3D point
151-
* @return The projection jacobian with respect to the rotation
152-
*/
153-
virtual Eigen::Matrix<double, 2, 9> getDerivativeTransformProjectWrtRotation(const Eigen::Matrix4d& pose, const Vec4& pt) const = 0;
154-
155-
/**
156-
* @brief Get the derivative of a projection of a 3D point into the camera plane
157-
* @param[in] pose The pose
158-
* @param[in] pt3D The 3D point
159-
* @return The projection jacobian with respect to the pose
160-
*/
161-
virtual Eigen::Matrix<double, 2, 16> getDerivativeTransformProjectWrtPoseLeft(const Eigen::Matrix4d& pose, const Vec4& pt3D) const = 0;
162-
163-
/**
164-
* @brief Get the derivative of a projection of a 3D point into the camera plane
165-
* @param[in] pose The pose
166-
* @param[in] pt3D The 3D point
167-
* @return The projection jacobian with respect to the point
168-
*/
169-
virtual Eigen::Matrix<double, 2, 4> getDerivativeTransformProjectWrtPoint(const Eigen::Matrix4d& pose, const Vec4& pt3D) const = 0;
170-
139+
171140
/**
172141
* @brief Get the derivative of a projection of a 3D point into the camera plane
173142
* @param[in] pose The pose

src/aliceVision/camera/Pinhole.cpp

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -61,132 +61,6 @@ Vec2 Pinhole::project(const Vec4& pt, bool applyDistortion) const
6161
return impt;
6262
}
6363

64-
Eigen::Matrix<double, 2, 9> Pinhole::getDerivativeTransformProjectWrtRotation(const Eigen::Matrix4d& pose, const Vec4& pt) const
65-
{
66-
const Vec4 X = pose * pt; // apply pose
67-
68-
const Eigen::Matrix<double, 3, 9> d_X_d_R = getJacobian_AB_wrt_A<3, 3, 1>(pose.block<3, 3>(0, 0), pt.head(3));
69-
70-
const Vec2 P = X.head<2>() / X(2);
71-
72-
Eigen::Matrix<double, 2, 3> d_P_d_X;
73-
d_P_d_X(0, 0) = 1 / X(2);
74-
d_P_d_X(0, 1) = 0;
75-
d_P_d_X(0, 2) = -X(0) / (X(2) * X(2));
76-
d_P_d_X(1, 0) = 0;
77-
d_P_d_X(1, 1) = 1 / X(2);
78-
d_P_d_X(1, 2) = -X(1) / (X(2) * X(2));
79-
80-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_X * d_X_d_R;
81-
}
82-
83-
Eigen::Matrix<double, 2, 16> Pinhole::getDerivativeTransformProjectWrtPose(const Eigen::Matrix4d& pose, const Vec4& pt) const
84-
{
85-
const Eigen::Matrix4d T = pose;
86-
87-
const Vec4 X = T * pt; // apply pose
88-
89-
const Eigen::Matrix<double, 4, 16> d_X_d_T = getJacobian_AB_wrt_A<4, 4, 1>(T, pt);
90-
91-
const Vec2 P = X.head<2>() / X(2);
92-
93-
Eigen::Matrix<double, 2, 3> d_P_d_X;
94-
d_P_d_X(0, 0) = 1 / X(2);
95-
d_P_d_X(0, 1) = 0;
96-
d_P_d_X(0, 2) = -X(0) / (X(2) * X(2));
97-
d_P_d_X(1, 0) = 0;
98-
d_P_d_X(1, 1) = 1 / X(2);
99-
d_P_d_X(1, 2) = -X(1) / (X(2) * X(2));
100-
101-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_X * d_X_d_T.block<3, 16>(0, 0);
102-
}
103-
104-
Eigen::Matrix<double, 2, 16> Pinhole::getDerivativeTransformProjectWrtPoseLeft(const Eigen::Matrix4d& pose, const Vec4& pt) const
105-
{
106-
const Eigen::Matrix4d T = pose;
107-
108-
const Vec4 X = T * pt; // apply pose
109-
110-
const Eigen::Matrix<double, 4, 16> d_X_d_T = getJacobian_AB_wrt_A<4, 4, 1>(Eigen::Matrix4d::Identity(), X);
111-
112-
const Vec2 P = X.head<2>() / X(2);
113-
114-
double x = X(0);
115-
double y = X(1);
116-
double z = X(2);
117-
double invz = 1.0 / z;
118-
double invzsq = invz * invz;
119-
double mxinvzsq = -x * invzsq;
120-
double myinvzsq = -y * invzsq;
121-
122-
Eigen::Matrix<double, 2, 3> d_P_d_X;
123-
d_P_d_X(0, 0) = 1 / X(2);
124-
d_P_d_X(0, 1) = 0;
125-
d_P_d_X(0, 2) = -X(0) / (X(2) * X(2));
126-
d_P_d_X(1, 0) = 0;
127-
d_P_d_X(1, 1) = 1 / X(2);
128-
d_P_d_X(1, 2) = -X(1) / (X(2) * X(2));
129-
130-
Eigen::Matrix<double, 2, 16> d_P_d_T;
131-
d_P_d_T(0, 0) = invz * X(0);
132-
d_P_d_T(0, 1) = 0.0;
133-
d_P_d_T(0, 2) = mxinvzsq * X(0);
134-
d_P_d_T(0, 3) = 0;
135-
d_P_d_T(0, 4) = invz * X(1);
136-
d_P_d_T(0, 5) = 0.0;
137-
d_P_d_T(0, 6) = mxinvzsq * X(1);
138-
d_P_d_T(0, 7) = 0;
139-
d_P_d_T(0, 8) = invz * X(2);
140-
d_P_d_T(0, 9) = 0.0;
141-
d_P_d_T(0, 10) = mxinvzsq * X(2);
142-
d_P_d_T(0, 11) = 0;
143-
d_P_d_T(0, 12) = invz;
144-
d_P_d_T(0, 13) = 0.0;
145-
d_P_d_T(0, 14) = mxinvzsq;
146-
d_P_d_T(0, 15) = 0;
147-
148-
d_P_d_T(1, 0) = 0.0;
149-
d_P_d_T(1, 1) = invz * X(0);
150-
d_P_d_T(1, 2) = myinvzsq * X(0);
151-
d_P_d_T(1, 3) = 0.0;
152-
d_P_d_T(1, 4) = 0.0;
153-
d_P_d_T(1, 5) = invz * X(1);
154-
d_P_d_T(1, 6) = myinvzsq * X(1);
155-
d_P_d_T(1, 7) = 0.0;
156-
d_P_d_T(1, 8) = 0.0;
157-
d_P_d_T(1, 9) = invz * X(2);
158-
d_P_d_T(1, 10) = myinvzsq * X(2);
159-
d_P_d_T(1, 11) = 0.0;
160-
d_P_d_T(1, 12) = 0.0;
161-
d_P_d_T(1, 13) = invz;
162-
d_P_d_T(1, 14) = myinvzsq;
163-
d_P_d_T(1, 15) = 0.0;
164-
165-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_T;
166-
}
167-
168-
Eigen::Matrix<double, 2, 4> Pinhole::getDerivativeTransformProjectWrtPoint(const Eigen::Matrix4d& pose, const Vec4& pt) const
169-
{
170-
const Eigen::Matrix4d T = pose;
171-
const Vec4 X = T * pt; // apply pose
172-
173-
const Eigen::Matrix<double, 4, 4>& d_X_d_P = getJacobian_AB_wrt_B<4, 4, 1>(T, pt);
174-
175-
const Vec2 P = X.head<2>() / X(2);
176-
177-
Eigen::Matrix<double, 2, 4> d_P_d_X;
178-
d_P_d_X(0, 0) = 1 / X(2);
179-
d_P_d_X(0, 1) = 0;
180-
d_P_d_X(0, 2) = -X(0) / (X(2) * X(2));
181-
d_P_d_X(0, 3) = 0;
182-
d_P_d_X(1, 0) = 0;
183-
d_P_d_X(1, 1) = 1 / X(2);
184-
d_P_d_X(1, 2) = -X(1) / (X(2) * X(2));
185-
d_P_d_X(1, 3) = 0;
186-
187-
return getDerivativeCam2ImaWrtPoint() * getDerivativeAddDistoWrtPt(P) * d_P_d_X * d_X_d_P;
188-
}
189-
19064
Eigen::Matrix<double, 2, 3> Pinhole::getDerivativeTransformProjectWrtPoint3(const Eigen::Matrix4d& T, const Vec4& pt) const
19165
{
19266
const Vec4 X = T * pt; // apply pose

0 commit comments

Comments
 (0)