Created
March 8, 2018 09:23
-
-
Save nulledge/49414eba3eb48158f9c24c020a5a8bdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [Proj D radial tan r2] = ProjectPointRadial(P, R, T, f, c, k, p) | |
N = size(P,1); | |
X = R*(P'-T'*ones(1,N)); | |
XX = X(1:2,:)./([1; 1]*X(3,:)); | |
r2 = XX(1,:).^2 + XX(2,:).^2; | |
radial = 1 + dot(repmat(k',[1 N]), [r2; r2.^2; r2.^3], 1); | |
tan = p(1)*XX(2,:) + p(2)*XX(1,:); | |
XXX = XX.*repmat(radial+tan,[2 1]) + [p(2) p(1)]'*r2; | |
Proj = ones(N,1)*f .* XXX' + ones(N,1)*c; | |
D = X(3,:); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment