No BSD License  

Highlights from
GeoML

image thumbnail
from GeoML by Gabriele Lombardi
A general morphable template tool for image segmentation.

points2domogenize(Pi)
function Po = points2domogenize(Pi)
% POINTS2DOMOGENIZE  Enshure a 3-coords omogeneous set of points
%
%  This function add, if required, a third coord to a set of points to
% generate a set of omogeneous points of the plane (adding a one as third
% coord).
%
%  Params:
%
% Pi:   Input points
% 
% Po:   Output omogeneous points

% Check the size of the input matrix
coords = size(Pi,1);
if coords~=2 && coords~=3
    error('The input parameter must be a set of points in a matrix 2xN or 3xN');
end

% Check if the third coord must be added
if coords==2
    % Adding the ones
    Po = [Pi;ones(1,size(Pi,2))];
else
    Po = Pi;
end

Contact us at files@mathworks.com