个不难的:
-
图像预处理,自动阀值方法二值化,然后滤掉噪声点,得到比较干净的圆形光斑离散点集;
-
用以下这个程序拟合出离散点的圆,并找出圆心。
其中第一步的自动阀值可以用otsu函数(otsu
method,大津法),其余都很基础;第二步的程序如果看不懂,可以进一步看看参考资料连接。
function
[xc,yc,R,a]
=
circfit(x,y)
%
%
[xc
yx
R]
=
circfit(x,y)
%
%
fits
a
circle
in
x,y
plane
in
a
more
accurate
%
(less
prone
to
ill
condition
)
%
procedure
than
circfit2
but
using
more
memory
%
x,y
are
column
vector
where
(x(i),y(i))
is
a
measured
point
%
%
result
is
center
point
(yc,xc)
and
radius
R
%
an
optional
output
is
the
vector
of
coeficient
a
%
describing
the
circle's
equation
%
%
x^2+y^2+a(1)*x+a(2)*y+a(3)=0
%
%
By:
Izhak
bucher
25/oct
/1991,
x=x(:)
y=y(:)
a=[x
y
ones(size(x))]\[-(x.^2+y.^2)]
xc
=
-.5*a(1)
yc
=
-.5*a(2)
R
=
sqrt((a(1)^2+a(2)^2)/4-a(3))
参考资料:
一种是利用图像工具栏的放大功能,用肉眼读出。具体做法为:不断放大目标点,直到坐标精度达到使用者的要求
第二种是利用ginput函数,从图中点击不同位置获取不同点的坐标值,但是这个坐标值是相对坐标,不是绝对坐标
a = ginput(1)disp(a)此时使用者只需在图中点击目标点,即可显示出目标点坐标。
最后一种是利用工具栏中的tip工具,插入数据点标注,这个功能不仅能精确得到点坐标,而且可以标识出来。
工具栏->insert->tip工具。点击待读入点即可,程序会自动定位至曲线上
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)