⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compute3dstructure.m

📁 包括计算机科学和工程、信号处理、物理学、应用数学和统计学
💻 M
字号:
% [X,lambda] = compute3DStructure(p, q, R, T)
% p - first image coordinates
% q - second image  coordinates
% R, T - displacement between the views
% X - 3D coordinates of the points with respect to 1st and 2nd view
% lambda - scales with respect to the first view (lambda x = X)

% The basic linear triangulation algorithm 
% for recovering the depth of a point given the projection onto
% two images and the relative pose of the cameras,
% as described in Chapter 5, "An introduction to 3-D Vision"
% by Y. Ma, S. Soatto, J. Kosecka, S. Sastry (MASKS)
%
% Code distributed free for non-commercial use
% Copyright (c) MASKS, 2003
%
% Last modified 5/5/2003


function [XP, lambda] = compute3DStructure(p, q, R, T);
nc = size(q, 2);

% linear triangulation method
M = [];
for i=1:nc
  A = [ 0 -1  p(2,i) 0;
	-1  0 p(1,i) 0;
	(-R(2,:) + q(2,i)*R(3,:)) -T(2) + q(2,i)*T(3);
	(-R(1,:) + q(1,i)*R(3,:)) -T(1) + q(1,i)*T(3)];
  [ua,sa,va] = svd(A);
  X(:,i) = va(:,4);
end
XP(:,:,1) = [X(1,:)./X(4,:);X(2,:)./X(4,:);X(3,:)./X(4,:); X(4,:)./X(4,:)];
lambda = XP(3,:,1);

XP(:,:,2) = [R, T; 0 0 0 1]*XP(:,:,1);






⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -