Skip to content
Browse files

RPCStereoModel: Add API to return 3D error

  • Loading branch information...
1 parent 2d836ab commit 0ffbecbc72bd93a6dec25be182964fc078666a3c @oleg-alexandrov oleg-alexandrov committed Nov 20, 2012
Showing with 23 additions and 15 deletions.
  1. +19 −14 src/asp/Sessions/RPC/RPCStereoModel.cc
  2. +4 −1 src/asp/Sessions/RPC/RPCStereoModel.h
View
33 src/asp/Sessions/RPC/RPCStereoModel.cc
@@ -52,7 +52,12 @@ namespace asp {
};
}
- Vector3 RPCStereoModel::operator()(Vector2 const& pix1, Vector2 const& pix2, double& error) const {
+ Vector3 RPCStereoModel::operator()(Vector2 const& pix1, Vector2 const& pix2,
+ Vector3& errorVec) const {
+
+ // Note: This is a re-implementation of StereoModel::operator().
+
+ errorVec = Vector3();
// Check for NaN values
if (pix1 != pix1 || pix2 != pix2) return Vector3();
@@ -62,28 +67,22 @@ namespace asp {
if (rpc_model1 == NULL || rpc_model2 == NULL){
VW_OUT(ErrorMessage) << "RPC camera models expected.\n";
- error = 0.0;
return Vector3();
}
try {
-
- Vector3 result;
-
- Vector3 origin1, vec1;
+
+ Vector3 origin1, vec1, origin2, vec2;
rpc_model1->point_and_dir(pix1, origin1, vec1);
-
- Vector3 origin2, vec2;
rpc_model2->point_and_dir(pix2, origin2, vec2);
if (are_nearly_parallel(vec1, vec2)){
- error = 0.0;
return Vector3();
}
- result = triangulate_point(origin1, vec1,
- origin2, vec2,
- error);
+ Vector3 result = triangulate_point(origin1, vec1,
+ origin2, vec2,
+ errorVec);
if ( m_least_squares ){
@@ -106,9 +105,15 @@ namespace asp {
return result;
} catch (...) {}
-
- error = 0.0;
return Vector3();
}
+ Vector3 RPCStereoModel::operator()(Vector2 const& pix1, Vector2 const& pix2,
+ double& error ) const {
+ Vector3 errorVec;
+ Vector3 result = RPCStereoModel::operator()(pix1, pix2, errorVec);
+ error = norm_2(errorVec);
+ return result;
+ }
+
} // namespace asp
View
5 src/asp/Sessions/RPC/RPCStereoModel.h
@@ -52,7 +52,10 @@ namespace asp {
/// parallel or divergent, otherwise it returns the 2-norm of the
/// distance between the rays at their nearest point of
/// intersection.
- virtual vw::Vector3 operator()(vw::Vector2 const& pix1, vw::Vector2 const& pix2, double& error) const;
+ virtual vw::Vector3 operator()(vw::Vector2 const& pix1, vw::Vector2 const& pix2,
+ vw::Vector3& errorVec) const;
+ virtual vw::Vector3 operator()(vw::Vector2 const& pix1, vw::Vector2 const& pix2,
+ double& error) const;
};

0 comments on commit 0ffbecb

Please sign in to comment.
Something went wrong with that request. Please try again.