• 大小: 2KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-15
  • 语言: 其他
  • 标签: 相机标定  

资源简介

实用于目前通用的9*11圆心标定板圆心排序的算法,算法需要提前读取到小圆、大圆的圆心坐标。本例中提供了一个小圆和大圆圆心坐标txt文件,直接运行sort_corner.m即可。

资源截图

代码片段和文件信息

A=load(‘small_circle.txt‘);
B=load(‘big_circle.txt‘);
figure(1);
hold on;
plot(A(:1)A(:2)‘r+‘);
plot(B(:1)B(:2)‘bo‘);

%找到标记圆和X方向、Y方向的距离
for i=1:size(B1)
    for j=1:size(B1)
        if(B(i2)-B(j2)<10 &&i~=j)
            if(B(i1)                flag_point = B(i:);
            else
                flag_point = B(j:);
            end
        end
    end
end
plot(flag_point(1)flag_point(2)‘g.‘);
kdtreeobj = KDTreeSearcher(A‘distance‘‘euclidean‘);
for i=1:size(A1)
    search=flag_point;
    [idxdist]=knnsearch(Asearch‘dist‘‘euclidean‘‘k‘5);
end
X_dis=0;
for j=2:5
    if(abs(A(idx(j)2)-flag_point(2))<10)
        X_dis=norm(A(idx(j):)-flag_point)+X_dis;
    end
end
X_dis=X_dis/2;

%找到第一列元素
lie_point=[];
point_A=min(A(:1));
XX=A(:1);
kdtreeobj = KDTreeSearcher(XX‘distance‘‘euclidean‘);
for i=1:size(A1)
    [idxdist]=knnsearch(XXpoint_A‘dist‘‘euclidean‘‘k‘9);
end
for i=1:9
    plot(A(idx(i)1)A(idx(i)2)‘b.‘);
    lie_point=[lie_point;A(idx(i):)];
end
if(lie_point(12)>lie_point(22))
  lie_point=flipud(lie_point);
end

%找到第二列元素
lie_point_1=[];
for i=1:9
    search=[lie_point(i1)+X_dislie_point(i2)];
    for o=1:size(A1)
    [idxdist]=knnsearch(Asearch‘dist‘‘euclidean‘‘k‘1);
    end
    lie_point_1=[lie_point_1;A(idx(1):)];
end
plot(lie_point(:1)lie_point(:2)‘k+‘);
plot(lie_point_1(:1)lie_point_1(:2)‘k+‘);

%排序
record_point=[lie_pointlie_point_1];
hang_point=[];
out_put=[];
for i=1:9
    angle_x=atand((record_point(i4)-record_point(i2))/(record_point(i3)-record_point(i1)));
    for j=1:99
       if(norm(A(j:)- record_point(i1:2))==0)
           angle(j)=angle_x;
       else
           angle(j)=atand((A(j2)-record_point(i2))/(A(j1)-record_point(i1)));
       end
       if(abs(angle_x-angle(j))<3)
         plot(A(j1)A(j2)‘k+‘);
         hang_point=[hang_point;A(j:)];
       end
    end
    LL=record_point(i1:2);
    XYZ=[hang_point(:1)hang_point(:2)];
    kdtreeobj = KDTreeSearcher(XYZ(:[12])‘distance‘‘euclidean‘);
   [idxdist]=knnsearch(XYZLL‘dist‘‘euclidean‘‘k‘11);
    for j=1:11
        out_put=[out_put;XYZ(idx(j):)];
    end
    hang_point=[];
end
hold off;

%顺次连接各点
figure(2);
hold on;
plot(A(:1)A(:2)‘r+‘);
for i=1:98
    A_x=out_put(i1);
    A_y=out_put(i2);
    B_x=out_put(i+11);
    B_y=out_put(i+12);
    plot([A_xB_x][A_yB_y]‘b‘);
end
hold off;

figure(3);
hold on;
z=1;
zz=1;
while(zz)
   for i=-4:1:4
    for j=-5:1:5
        plot(out_put(z1)out_put(z2)‘r.‘);
        text(out_put(z1)out_put(z2)[‘(‘num2str(j)‘‘num2str(i)‘)‘]);
        z=z+1;
    end
    if z>99
        zz=0;
    end
   end
end


    





















    
    
 
    
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         82  2020-08-17 18:39  圆形标定板排序\big_circle.txt

     文件       1492  2020-08-17 18:39  圆形标定板排序\small_circle.txt

     文件       2893  2020-08-18 11:39  圆形标定板排序\sort_corner.m

     目录          0  2020-08-18 11:38  圆形标定板排序

----------- ---------  ---------- -----  ----

                 4467                    4


评论

共有 条评论