Skip to content

Instantly share code, notes, and snippets.

@amiltonwong
Created August 9, 2015 06:13
Show Gist options
  • Save amiltonwong/815d6b0327eaa9a6d1b8 to your computer and use it in GitHub Desktop.
Save amiltonwong/815d6b0327eaa9a6d1b8 to your computer and use it in GitHub Desktop.
function [ Jac, residual ] = deriveErrNumeric( IRef, DRef, I, xi, K )
% calculate numeric derivative. SLOW
eps = 1e-6;
Jac = zeros(size(I,1) * size(I,2),6);
residual = calcErr(IRef,DRef,I,xi,K);
for j=1:6
epsVec = zeros(6,1);
epsVec(j) = eps;
% multiply epsilon from left onto the current estimate.
xiPerm = se3Log(se3Exp(epsVec) * se3Exp(xi));
Jac(:,j) = (calcErr(IRef,DRef,I,xiPerm,K) - residual) / eps;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment