handle chirelity exception
parent
e9ae2b5cc7
commit
b735d30c7d
|
|
@ -77,15 +77,20 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** h(x)-z */
|
/** h(x)-z */
|
||||||
Vector evaluateError(
|
Vector evaluateError(const Cam& camera, const Point3& point,
|
||||||
const Cam& camera,
|
boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H2=boost::none) const {
|
||||||
const Point3& point,
|
|
||||||
boost::optional<Matrix&> H1=boost::none,
|
|
||||||
boost::optional<Matrix&> H2=boost::none) const {
|
|
||||||
|
|
||||||
Vector error = z_.localCoordinates(camera.project2(point,H1,H2));
|
try {
|
||||||
// gtsam::print(error, "error");
|
Point2 reprojError(camera.project2(point,H1,H2) - z_);
|
||||||
return error;
|
return reprojError.vector();
|
||||||
|
}
|
||||||
|
catch( CheiralityException& e) {
|
||||||
|
if (H1) *H1 = zeros(2, camera.dim());
|
||||||
|
if (H2) *H2 = zeros(2, point.dim());
|
||||||
|
// cout << e.what() << ": Landmark "<< this->key2_.index()
|
||||||
|
// << " behind Camera " << this->key1_.index() << endl;
|
||||||
|
return zero(2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** return the measured */
|
/** return the measured */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue