Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Usgscsm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
88eb5896
Unverified
Commit
88eb5896
authored
2 months ago
by
Austin Sanders
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Cahvor fix (#490)
* Removed tolerance check from optical shift addition * Updated changelog
parent
b861a956
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-1
4 additions, 1 deletion
CHANGELOG.md
src/Distortion.cpp
+45
-51
45 additions, 51 deletions
src/Distortion.cpp
with
49 additions
and
52 deletions
CHANGELOG.md
+
4
−
1
View file @
88eb5896
...
...
@@ -35,6 +35,9 @@ release.
## [Unreleased]
### Fixed
-
Fixed CAHVOR model optical shifts by removing tolerance check
[
#488
](
https://github.com/DOI-USGS/usgscsm/issues/488
)
## [2.0.1] - 2024-01-23
### Changed
...
...
@@ -51,4 +54,4 @@ release.
-
Updated ALE submodule
[
#470
](
https://github.com/DOI-USGS/usgscsm/pull/470
)
### Fixed
-
Fixed issue with radial distortion computation
[
#464
](
https://github.com/DOI-USGS/usgscsm/pull/464
)
\ No newline at end of file
-
Fixed issue with radial distortion computation
[
#464
](
https://github.com/DOI-USGS/usgscsm/pull/464
)
This diff is collapsed.
Click to expand it.
src/Distortion.cpp
+
45
−
51
View file @
88eb5896
...
...
@@ -328,16 +328,13 @@ void removeDistortion(double dx, double dy, double &ux, double &uy,
double
shiftedDy
=
dy
-
opticalDistCoeffs
[
4
];
double
rr
=
shiftedDx
*
shiftedDx
+
shiftedDy
*
shiftedDy
;
if
(
rr
>
tolerance
)
{
double
dr
=
opticalDistCoeffs
[
0
]
+
(
rr
*
(
opticalDistCoeffs
[
1
]
+
rr
*
opticalDistCoeffs
[
2
]));
double
dr
=
opticalDistCoeffs
[
0
]
+
(
rr
*
(
opticalDistCoeffs
[
1
]
+
rr
*
opticalDistCoeffs
[
2
]));
ux
=
shiftedDx
*
(
1.0
-
dr
);
uy
=
shiftedDy
*
(
1.0
-
dr
);
ux
+=
opticalDistCoeffs
[
3
];
uy
+=
opticalDistCoeffs
[
4
];
}
ux
=
shiftedDx
*
(
1.0
-
dr
);
uy
=
shiftedDy
*
(
1.0
-
dr
);
ux
+=
opticalDistCoeffs
[
3
];
uy
+=
opticalDistCoeffs
[
4
];
}
break
;
...
...
@@ -587,51 +584,48 @@ void applyDistortion(double ux, double uy, double &dx, double &dy,
double
shiftedUx
=
ux
-
opticalDistCoeffs
[
3
];
double
shiftedUy
=
uy
-
opticalDistCoeffs
[
4
];
double
rp2
=
(
ux
*
ux
)
+
(
uy
*
uy
);
double
rp
=
sqrt
(
rp2
);
// Compute first fractional distortion using rp
double
drOverR
=
opticalDistCoeffs
[
0
]
+
(
rp2
*
(
opticalDistCoeffs
[
1
]
+
(
rp2
*
opticalDistCoeffs
[
2
])));
if
(
rp2
>
tolerance
)
// Compute first distorted point estimate, r
double
r
=
rp
+
(
drOverR
*
rp
);
double
r_prev
,
r2_prev
;
int
iteration
=
0
;
do
{
double
rp
=
sqrt
(
rp2
);
// Compute first fractional distortion using rp
double
drOverR
=
opticalDistCoeffs
[
0
]
+
(
rp2
*
(
opticalDistCoeffs
[
1
]
+
(
rp2
*
opticalDistCoeffs
[
2
])));
// Compute first distorted point estimate, r
double
r
=
rp
+
(
drOverR
*
rp
);
double
r_prev
,
r2_prev
;
int
iteration
=
0
;
do
// Don't get in an end-less loop. This algorithm should
// converge quickly. If not then we are probably way outside
// of the focal plane. Just set the distorted position to the
// undistorted position. Also, make sure the focal plane is less
// than 1km, it is unreasonable for it to grow larger than that.
if
(
iteration
>=
20
||
r
>
1E9
)
{
// Don't get in an end-less loop. This algorithm should
// converge quickly. If not then we are probably way outside
// of the focal plane. Just set the distorted position to the
// undistorted position. Also, make sure the focal plane is less
// than 1km, it is unreasonable for it to grow larger than that.
if
(
iteration
>=
20
||
r
>
1E9
)
{
drOverR
=
0.0
;
break
;
}
r_prev
=
r
;
r2_prev
=
r
*
r
;
// Compute new fractional distortion:
drOverR
=
opticalDistCoeffs
[
0
]
+
(
r2_prev
*
(
opticalDistCoeffs
[
1
]
+
(
r2_prev
*
opticalDistCoeffs
[
2
])));
// Compute new estimate of r
r
=
rp
+
(
drOverR
*
r_prev
);
iteration
++
;
}
while
(
fabs
(
r
-
r_prev
)
>
desiredPrecision
);
dx
=
shiftedUx
/
(
1.0
-
drOverR
);
dy
=
shiftedUy
/
(
1.0
-
drOverR
);
dx
+=
opticalDistCoeffs
[
3
];
dy
+=
opticalDistCoeffs
[
4
];
}
drOverR
=
0.0
;
break
;
}
r_prev
=
r
;
r2_prev
=
r
*
r
;
// Compute new fractional distortion:
drOverR
=
opticalDistCoeffs
[
0
]
+
(
r2_prev
*
(
opticalDistCoeffs
[
1
]
+
(
r2_prev
*
opticalDistCoeffs
[
2
])));
// Compute new estimate of r
r
=
rp
+
(
drOverR
*
r_prev
);
iteration
++
;
}
while
(
fabs
(
r
-
r_prev
)
>
desiredPrecision
);
dx
=
shiftedUx
/
(
1.0
-
drOverR
);
dy
=
shiftedUy
/
(
1.0
-
drOverR
);
dx
+=
opticalDistCoeffs
[
3
];
dy
+=
opticalDistCoeffs
[
4
];
}
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment