资源简介
详细介绍了利用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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6843 2006-09-09 20:42 MLS\MLSD2DTransform.m
文件 1960 2006-09-08 11:59 MLS\MLSD2DWarp.m
文件 10238 2006-09-09 20:41 MLS\MLSD2DlinesPrecompute.m
文件 5577 2006-09-09 20:41 MLS\MLSD2DpointsPrecompute.m
文件 3009 2006-09-11 15:23 MLS\MLSDeformImage.m
文件 2789 2006-09-11 15:23 MLS\MLSDeformPoints.m
文件 4634 2006-09-13 14:58 MLS\html\MLSDdemo_01.png
文件 5270 2006-09-13 14:58 MLS\html\MLSDdemo_02.png
文件 534278 2006-09-13 14:58 MLS\html\MLSDdemo_03.png
文件 548173 2006-09-13 14:59 MLS\html\MLSDdemo_04.png
文件 9448 2006-09-13 14:59 MLS\html\MLSDdemo.png
文件 17744 2006-09-13 14:59 MLS\html\MLSDdemo.html
文件 1788 2005-07-20 16:42 MLS\getpoints.m
文件 1273 2005-04-26 15:39 MLS\plotpoints.m
文件 942 2005-12-15 13:20 MLS\points2dnormalize.m
文件 1254 2005-06-05 23:07 MLS\strin.m
文件 6337 2006-09-13 14:56 MLS\MLSDdemo.m
文件 70238 2006-09-11 15:51 MLS\image.jpg
文件 1207 2005-05-04 15:18 MLS\plotshape.m
文件 1876 2006-04-24 18:18 MLS\plotpointsLabels.m
目录 0 2006-09-13 14:59 MLS\html
目录 0 2006-09-13 14:56 MLS
----------- --------- ---------- ----- ----
1234878 22
- 上一篇:MATLAB雷达多普勒微动仿真
- 下一篇:SIMUli
nk模块介绍——转载.ppt
评论
共有 条评论