7#include "RollingShutterCameraDetectorMap.h"
27 std::vector<double> times,
28 std::vector<double> sampleCoeffs,
77 const double deltaT) {
78 std::pair<double, double> jittered =
removeJitter(sample, line);
130 std::pair<double, double> jittered =
removeJitter(sample, line);
131 double currentSample = sample;
132 double currentLine = line;
135 int maxIterations = 50;
137 while((qFabs(sample - jittered.first) > 1e-7) ||
138 (qFabs(line - jittered.second) > 1e-7)) {
140 currentSample = sample + (currentSample - jittered.first);
141 currentLine = line + (currentLine - jittered.second);
146 if (iterations > maxIterations) {
147 QString message =
"Max Iterations reached.";
153 return std::pair<double, double>(currentSample, currentLine);
171 double sampleDejitter = 0.0;
172 double lineDejitter = 0.0;
174 for (
unsigned int n = 1; n <=
m_lineCoeffs.size(); n++) {
184 timeEntry = (int)round(line);
186 double time =
m_times[timeEntry - 1];
188 time = pow(time, exponent);
189 sampleDejitter += (sampleCoeff * time);
190 lineDejitter += (lineCoeff * time);
192 return std::pair<double, double>(sample - sampleDejitter, line - lineDejitter);
Convert between parent image coordinates and detector coordinates.
double p_detectorLineSumming
The scaling factor for computing line resolution.
double p_parentLine
The parent line calculated from the detector.
double p_parentSample
The parent sample calculated from the detector.
double p_detectorSample
Detector coordinate sample value.
double p_detectorLine
Detector coordinate line value.
Camera * p_camera
Pointer to the camera.
double p_detectorSampleSumming
The scaling factor for computing sample resolution.
@ Unknown
A type of error that cannot be classified as any of the other error types.
RollingShutterCameraDetectorMap(Camera *parent, std::vector< double > times, std::vector< double > sampleCoeffs, std::vector< double > lineCoeffs)
Constructs a RollingShutterCameraDetectorMap.
std::vector< double > m_times
List of normalized [-1, 1] readout times for all the lines in the input image.
virtual ~RollingShutterCameraDetectorMap()
Destructor.
std::pair< double, double > applyJitter(const double sample, const double line)
Iteratively finds a solution to "apply" jitter to an image coordinate.
std::vector< double > m_sampleCoeffs
List of coefficients for the n-order polynomial characterizing the jitter in the sample direction.
std::vector< double > m_lineCoeffs
List of coefficients for the n-order polynomial characterizing the jitter in the line direction.
std::pair< double, double > removeJitter(const double sample, const double line)
Remove the distortion from the image (parent) coordinates.
virtual bool SetParent(const double sample, const double line)
Compute detector position from a parent image coordinate.
virtual bool SetDetector(const double sample, const double line)
Compute parent position from a detector coordinate.
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
virtual iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions.
bool isTimeSet()
Returns true if time has been initialized.
This is free and unencumbered software released into the public domain.