Skip to content

Commit

Permalink
Fixes to VW pixel projection error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottMcMichael committed May 27, 2015
1 parent 246d37e commit 9b3ee99
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/vw/BundleAdjustment/AdjustBase.h
Expand Up @@ -288,7 +288,7 @@ namespace ba {
unweighted_error = cmeasure->dominant() -
m_model(i, camera_idx,m_model.A_parameters(camera_idx),
m_model.B_parameters(i));
} catch (const camera::PixelToRayErr& e) {
} catch (const camera::PointToPixelErr& e) {
vw_out(WarningMessage,"ba") << "Unable to calculate starting error for point";
}
double mag = norm_2(unweighted_error);
Expand Down
4 changes: 2 additions & 2 deletions src/vw/BundleAdjustment/AdjustRef.h
Expand Up @@ -166,7 +166,7 @@ namespace ba {
this->m_model(i, camera_idx,
this->m_model.A_parameters(camera_idx),
this->m_model.B_parameters(i));
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}
double mag = norm_2(unweighted_error);
double weight = sqrt(this->m_robust_cost_func(mag)) / mag;
subvector(error,2*idx,2) = unweighted_error * weight;
Expand Down Expand Up @@ -307,7 +307,7 @@ namespace ba {
this->m_model(i, camera_idx,
this->m_model.A_parameters(camera_idx)-cam_delta,
this->m_model.B_parameters(i)-pt_delta);
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}
double mag = norm_2(unweighted_error);
double weight = sqrt(this->m_robust_cost_func(mag)) / mag;
subvector(new_error,2*idx,2) = unweighted_error * weight;
Expand Down
4 changes: 2 additions & 2 deletions src/vw/BundleAdjustment/AdjustRobustRef.h
Expand Up @@ -178,7 +178,7 @@ namespace ba {
this->m_model(i, camera_idx,
this->m_model.A_parameters(camera_idx),
this->m_model.B_parameters(i));
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}
// Fill in the entries of the sigma matrix with the uncertainty of the observations.
Matrix2x2 inverse_cov;
Vector2 pixel_sigma = (*(this->m_control_net))[i][m].sigma();
Expand Down Expand Up @@ -342,7 +342,7 @@ namespace ba {
this->m_model(i, camera_idx,
this->m_model.A_parameters(camera_idx)-cam_delta,
this-> m_model.B_parameters(i)-pt_delta);
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}
Matrix2x2 inverse_cov = submatrix(sigma, 2*idx, 2*idx, 2, 2);

// Populate the S_weights, mu_weights vectors
Expand Down
4 changes: 2 additions & 2 deletions src/vw/BundleAdjustment/AdjustRobustSparse.h
Expand Up @@ -174,7 +174,7 @@ namespace ba {
unweighted_error = (**fiter).m_location -
this->m_model(i,j,this->m_model.A_parameters(j),
this->m_model.B_parameters(i));
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}

Vector2 pixel_sigma = (**fiter).m_scale;
Matrix2x2 inverse_cov;
Expand Down Expand Up @@ -449,7 +449,7 @@ namespace ba {
try {
unweighted_error = (**fiter).m_location -
this->m_model(i,j,new_a,new_b);
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}

Matrix2x2 inverse_cov;
Vector2 pixel_sigma = (**fiter).m_scale;
Expand Down
4 changes: 2 additions & 2 deletions src/vw/BundleAdjustment/AdjustSparse.h
Expand Up @@ -170,7 +170,7 @@ namespace ba {
error = measure->m_location -
this->m_model(i,j,this->m_model.A_parameters(j),
this->m_model.B_parameters(i) );
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}

if ( error != Vector2() ) {
double mag = norm_2(error);
Expand Down Expand Up @@ -440,7 +440,7 @@ namespace ba {
try {
error = (**fiter).m_location -
this->m_model((**fiter).m_point_id,j,new_a,new_b);
} catch (const camera::PixelToRayErr& e) {}
} catch (const camera::PointToPixelErr& e) {}
double mag = norm_2( error );
double weight = sqrt( this->m_robust_cost_func(mag)) / mag;
error *= weight;
Expand Down
12 changes: 8 additions & 4 deletions src/vw/BundleAdjustment/BundleAdjustReport.h
Expand Up @@ -262,10 +262,14 @@ namespace ba {
math::CDFAccumulator<double> image_cdf;
BOOST_FOREACH( ControlPoint const& cp, *network ) {
BOOST_FOREACH( ControlMeasure const& cm, cp ) {
image_cdf(m_model.image_compare(cm.position(),
m_model(cp_index,cm.image_id(),
m_model.A_parameters(cm.image_id()),
m_model.B_parameters(cp_index))));
try{
image_cdf(m_model.image_compare(cm.position(),
m_model(cp_index,cm.image_id(),
m_model.A_parameters(cm.image_id()),
m_model.B_parameters(cp_index))));
} catch(const camera::PointToPixelErr& e) {
// Missed pixels are not included in the reporting statistics!
}
}
cp_index++;
}
Expand Down
8 changes: 4 additions & 4 deletions src/vw/BundleAdjustment/ModelBase.h
Expand Up @@ -74,7 +74,7 @@ namespace ba {
try {
// Get nominal function value
h0 = impl()(i,j,a_j,b_i);
} catch (const camera::PixelToRayErr& e) {
} catch (const camera::PointToPixelErr& e) {
// Unable to project this point into the camera, so abort!
return J;
}
Expand All @@ -93,7 +93,7 @@ namespace ba {
try {
Vector2 hi = impl()(i,j,a_j_prime, b_i);
select_col(J,n) = (hi-h0)/epsilon;
} catch (const camera::PixelToRayErr& e) {
} catch (const camera::PointToPixelErr& e) {
select_col(J,n) = Vector2();
}
}
Expand All @@ -114,7 +114,7 @@ namespace ba {
try {
// Get nominal function value
h0 = impl()(i,j,a_j, b_i);
} catch (const camera::PixelToRayErr& e) {
} catch (const camera::PointToPixelErr& e) {
// Unable to project this point into the camera so abort!
return J;
}
Expand All @@ -133,7 +133,7 @@ namespace ba {
try {
Vector2 hi = impl()(i,j,a_j,b_i_prime);
select_col(J,n) = (hi-h0)/epsilon;
} catch (const camera::PixelToRayErr& e) {
} catch (const camera::PointToPixelErr& e) {
select_col(J,n) = Vector2();
}
}
Expand Down

0 comments on commit 9b3ee99

Please sign in to comment.