⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genpoints_ellipse.m

📁 摄像机圆球标定程序(包括SDP,DSDP,IDC,DIDC,ALG,DALG六种算法的实现)
💻 M
字号:
function [points]=GenPoints_ellipse(C,siz,n)
points=[];
if nargin<3
    n=100;
end
if nargin<2
    size=[480 640];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%test whether ellipse or nor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%get points of the ellipse
%standard form of the ellipse
%x=a*cos(o)
%y=b*sin(o)
internal=2*pi/(n-1);
% k=((C(1,1)*C(2,2)-C(1,2)*C(1,2))*(C(1,1)*C(3,3)-C(1,3)*C(1,3))...
% -(C(1,1)*C(2,3)-C(1,2)*C(1,3))*(C(1,1)*C(2,3)-C(1,2)*C(1,3)))/...
% ((C(1,1)*C(2,2)-C(1,2)*C(1,2)));
ty=-(C(1,1)*C(2,3)-C(1,2)*C(1,3))/(C(1,1)*C(2,2)-C(1,2)*C(1,2));
tx=-C(1,3)/C(1,1);
k=C(3,3)-C(1,3)*C(1,3)/C(1,1)-ty*ty*(C(1,1)*C(2,2)-C(1,2)*C(1,2))/C(1,1);
a_2=(-k)/C(1,1);
b_2=(-k)*C(1,1)/(C(1,1)*C(2,2)-C(1,2)*C(1,2));
a=sqrt(a_2);
b=sqrt(b_2);

for o=0:internal:2*pi
    y=b*sin(o)+ty;
    x=a*cos(o)-(C(1,2)/C(1,1))*y+tx;
    if y>0&&y<siz(1) &&x>0&x<siz(2)
        points=[points [x y 1]'];
    end
end

⌨️ 快捷键说明

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