pflat.m

来自「数学优化工具箱」· M 代码 · 共 21 行

M
21
字号
function [y,alpha]=pflat(x);
% [y,alpha]=pflat(x) - normalization of projective points.
% Do a normalization on the projective
% points in x. Each column is considered to
% be a point in homogeneous coordinates.
% Normalize so that the last coordinate becomes 1.
% WARNING! This is not good if the last coordinate is 0.
% INPUT :
%  x     - matrix in which each column is a point.
%        OR structure or imagedata object with points
% OUTPUT :
%  y     - result after normalization (in homogeneous coordinates)
%  alpha - depth

if isa(x,'structure') | isa (x,'imagedata'),
  x=getpoints(x);
end
[a,n]=size(x);
alpha=x(a,:);
y=x./(ones(a,1)*alpha);

⌨️ 快捷键说明

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