• 大小: 1.06MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-16
  • 语言: Matlab
  • 标签:

资源简介

通过移动的最小二乘法改变和自定义的控制点操作图片。Image Deformation Using Moving Least Squares 移动最小二乘法 图像变形(matlab实现)

资源截图

代码片段和文件信息

function P = getpoints(Nforcemark)
% GETPOINTS  Allow to get from the current figure a set of N points
%
%  This function allow to select a set of N points by picing them with the
% mouse on the current figure. If the parameter is omitted the number of
% points is selected from the user.
%
%  Params:
%
% N         = The number of points. (def=any=0)
% force     = Points must be precisely N (true)? (def=true)
% mark      = The marker to be used ‘‘ for no marker. (def=‘ro‘)
%
% P         = The points (as a matrix 2xN)
%
%  Examples:
%
%  Plot the selected points:
% >> imshow(img); hold on; plotpoints(getpoints);

% The def params:
if nargin<1 N = 0; end
if nargin<2 force = true; end
if nargin<3 mark = ‘ro‘; end

% Obtaining the points:
npts = 0;
P = [];
if N==0
        [XY] = getpts;
        P = [XY]‘;
        npts = numel(X);
else
    while (force && npts        % Get another set of points:
        if strcmp(‘‘mark)
            [XY] = ginput(N-npts);
        else
            [XY] = GetPoints(N-nptsmark);
        end

        % Converting the points format and counting:
        P = [P[XY]‘];
        npts = size(P2);
    end
end

% If required removing the exceding points:
if nargin>0 && size(P2)>N
    P = P(:1:N);
end

% ------------------------ LOCAL FUNCTIONS ------------------------

% Get a set of points marking the points:
function [XY] = GetPoints(Nmark)

% Prepare holding
washold = ishold;
if ~washold
hold on;
end

% The acquisition cicle:
X = zeros(N1);
Y = zeros(N1);
for ind=1:N
    % Get a point:
    [X(ind)Y(ind)] = ginput(1);
    % Mark the point:
    plot(X(1:ind)Y(1:ind)mark);
end

% Correct the old hold state
if ~washold hold off; end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-02 20:44  MLS\
     文件        6843  2006-09-10 02:42  MLS\MLSD2DTransform.m
     文件        1960  2006-09-08 17:59  MLS\MLSD2DWarp.m
     文件       10238  2006-09-10 02:41  MLS\MLSD2DlinesPrecompute.m
     文件        5577  2006-09-10 02:41  MLS\MLSD2DpointsPrecompute.m
     文件        6337  2006-09-13 20:56  MLS\MLSDdemo.m
     文件        3009  2006-09-11 21:23  MLS\MLSDeformImage.m
     文件        2789  2006-09-11 21:23  MLS\MLSDeformPoints.m
     文件        1788  2005-07-20 22:42  MLS\getpoints.m
     目录           0  2019-04-02 20:44  MLS\html\
     文件       17744  2006-09-13 20:59  MLS\html\MLSDdemo.html
     文件        9448  2006-09-13 20:59  MLS\html\MLSDdemo.png
     文件      534278  2006-09-13 20:58  MLS\html\MLSDdemo_03.png
     文件      548173  2006-09-13 20:59  MLS\html\MLSDdemo_04.png
     文件        1273  2005-04-26 21:39  MLS\plotpoints.m
     文件        1876  2006-04-25 00:18  MLS\plotpointsLabels.m
     文件        1207  2005-05-04 21:18  MLS\plotshape.m
     文件         942  2005-12-15 20:20  MLS\points2dnormalize.m
     文件        1254  2005-06-06 05:07  MLS\strin.m

评论

共有 条评论