Fix crash when tracking in planar motion model (and maybe some other)

It was an Abort() caused by check for solver result not equal to USER_ABORT.

In some cases solver returns USER_ABORT due to BoundaryCheckingCallback
detects coordinates does not belong to image.

Somehow this callback wasn't called in previous version of Ceres and
in the same case marker was jumping. Now when the callback is called
it seems we could simply return failure of tracking without aborting
Blender.

Probably this is in fact some issue somewhere else, would double
check with Keir about this.
This commit is contained in:
Sergey Sharybin 2012-09-19 12:43:39 +00:00
parent 5a3e474cc6
commit 16a698ad4a

@ -1364,7 +1364,12 @@ void TemplatedTrackRegion(const FloatImage &image1,
// TODO(keir): Update the result statistics.
// TODO(keir): Add a normalize-cross-correlation variant.
CHECK_NE(summary.termination_type, ceres::USER_ABORT) << "Libmv bug.";
// TODO(sergey): in previous bundled Ceres from Windows branch our callback
// wasn't called, so USER_ABORT was never happen.
// now callback is calling and in some cases it returns SOLVER_ABORT
// not sure if it's bug somewhere or we could just mark tracking
// result as failed without causing general panic
// CHECK_NE(summary.termination_type, ceres::USER_ABORT) << "Libmv bug.";
if (summary.termination_type == ceres::USER_ABORT) {
result->termination = TrackRegionResult::FELL_OUT_OF_BOUNDS;
return;