Isis 3 Programmer Reference
BundleLidarControlPoint.cpp
1#include "BundleLidarControlPoint.h"
2
3// qt lib
4#include <QDebug>
5
6// std lib
7#include <vector>
8
9// boost lib
10#include <boost/lexical_cast.hpp>
11#include <boost/numeric/ublas/io.hpp>
12#include <boost/numeric/ublas/matrix_proxy.hpp>
13#include <boost/numeric/ublas/matrix_sparse.hpp>
14#include <boost/numeric/ublas/vector_proxy.hpp>
15
16// Isis lib
17#include "BundleLidarControlPoint.h"
18#include "BundleLidarRangeConstraint.h"
19#include "Camera.h"
20#include "ControlMeasure.h"
21#include "Latitude.h"
22#include "LidarControlPoint.h"
23#include "Longitude.h"
24#include "SpecialPixel.h"
25
26using namespace boost::numeric::ublas;
27
28namespace Isis {
29
42 LidarControlPointQsp lidarControlPoint)
43 : BundleControlPoint(bundleSettings, (ControlPoint*) lidarControlPoint.data()) {
44
45 m_lidarControlPoint = lidarControlPoint;
46 }
47
48
54
55 QStringList simultaneousSerialNumbers = m_lidarControlPoint->snSimultaneous();
56 for (int i= 0; i < size(); i++) {
57 BundleMeasureQsp measure = at(i);
58 if (!simultaneousSerialNumbers.contains(measure->cubeSerialNumber())) {
59 continue;
60 }
61
62 m_rangeConstraints.append(BundleLidarRangeConstraintQsp
63 (new BundleLidarRangeConstraint(m_lidarControlPoint, measure)));
64 }
65 }
66
67
74// BundleLidarControlPoint::BundleLidarControlPoint(const BundleLidarControlPoint &src) {
75// : BundleControlPoint(((ControlPoint) src) {
76// copy(src);
77// }
78
79
85
86
96
97
103 m_lidarControlPoint->ComputeResiduals();
104
105 // compute and store focal plane residuals in millimeters
106 for (int i = 0; i < size(); i++) {
107 at(i)->setFocalPlaneResidualsMillimeters();
108 }
109 }
110
111
116 LinearAlgebra::Vector imageSolution,
117 SparseBlockMatrix &sparseNormals,
118 const BundleTargetBodyQsp target) {
119 // Call parent class method to apply point corrections
120 BundleControlPoint::applyParameterCorrections(imageSolution, sparseNormals, target);
121
122 for (int i = 0; i < m_rangeConstraints.size(); i++) {
123 m_lidarControlPoint->setRange(m_rangeConstraints[i]->rangeComputed());
124 // The updated range sigma cannot be computed because the bundle does not
125 // solve for the range, it simply re-computes it each iteration
126 // m_lidarControlPoint->setRangeSigma(m_rangeConstraints[i]->rangeAdjustedSigma());
127 }
128 }
129
130
147 int constraintsApplied = 0;
148
149 // loop over range constraints
150 for (int i = 0; i < m_rangeConstraints.size(); i++) {
151 if (m_rangeConstraints.at(i)->applyConstraint(normalsMatrix, N22, N12, n1, n2)) {
152 constraintsApplied++;
153 }
154 }
155
156 return constraintsApplied;
157 }
158
159
167 double vtpv = 0.0;
168 for (int i = 0; i < m_rangeConstraints.size(); i++) {
169 vtpv += m_rangeConstraints.at(i)->vtpv();
170 }
171
172 return vtpv;
173 }
174
175
183 return m_rangeConstraints.size();
184 }
185
186
196 return m_rangeConstraints.at(n);
197 }
198
199
207 return m_lidarControlPoint->range();
208 }
209
210
218 return m_lidarControlPoint->sigmaRange();
219 }
220}
This class holds information about a control point that BundleAdjust needs to run correctly.
virtual void applyParameterCorrections(LinearAlgebra::Vector imageSolution, SparseBlockMatrix &sparseNormals, const BundleTargetBodyQsp target)
Apply the parameter corrections to the bundle control point.
double vtpv()
Compute vtpv, the weighted sum of squares of constrained point residuals.
void copy(const BundleControlPoint &src)
Copies given BundleControlPoint to this BundleControlPoint.
This class holds information about a lidar control point that BundleAdjust requires.
int applyLidarRangeConstraints(SparseBlockMatrix &normalsMatrix, LinearAlgebra::MatrixUpperTriangular &N22, SparseBlockColumnMatrix &N12, LinearAlgebra::VectorCompressed &n1, LinearAlgebra::Vector &n2)
Applies range constraint between image and lidar point acquired simultaneously.
BundleLidarControlPoint(BundleSettingsQsp bundleSettings, LidarControlPointQsp lidarControlPoint)
Constructs a BundleLidarControlPoint object from a LidarControlPoint.
BundleLidarRangeConstraintQsp rangeConstraint(int n)
Returns range constraint at index n.
int numberRangeConstraints()
Returns number of range constraints between this lidar point & images acquired simultaneously.
void computeResiduals()
Computes the residuals for this BundleLidarControlPoint.
virtual void applyParameterCorrections(LinearAlgebra::Vector imageSolution, SparseBlockMatrix &sparseNormals, const BundleTargetBodyQsp target)
Apply the parameter corrections to the lidar range.
double range()
Returns range between this point and ???
void copy(const BundleLidarControlPoint &src)
Copies given BundleLidarControlPoint to this BundleLidarControlPoint.
void initializeRangeConstraints()
Initialize range constraints.
~BundleLidarControlPoint()
TODO: implement? Copy constructor.
double vtpvRangeContribution()
Returns Weighted sum of squares of range residuals for this point.
double sigmaRange()
Returns sigma of observed range.
Implements range constraint between image position and lidar point acquired simultaneously with the i...
A single control point.
boost::numeric::ublas::compressed_vector< double > VectorCompressed
Definition for an Isis::LinearAlgebra::VectorCompressed of doubles.
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > MatrixUpperTriangular
Definition for an Isis::LinearAlgebra::MatrixUpperTriangular of doubles with an upper configuration.
SparseBlockColumnMatrix.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QSharedPointer< BundleLidarRangeConstraint > BundleLidarRangeConstraintQsp
Typdef for BundleLidarRangeConstraint QSharedPointer.