资源简介

老师给的课题,用matlab实现的识别打靶环数的判定,内附整体程序需要的算法小程序和测试图片已经分好,可以直接再matlab上运行

资源截图

代码片段和文件信息

function[hough_circle para]=hough_circle(BWstep_rstep_angler_minr_maxp)

[m n]=size(BW);
size_r=round((r_max-r_min)/step_r)+1;
size_angle=round(2*pi/step_angle);
hough_space=zeros(mnsize_r);
[rowscols]=find(BW);
ecount=size(rows);
for i=1:ecount
    for r=1:size_r
        for k=1:size_angle
            a=round(rows(i)-(r_min+(r-1)*step_r)*cos(k*step_angle));
            b=round(cols(i)-(r_min+(r-1)*step_r)*sin(k*step_angle));
            if(a>0&&a<=m&&b>0&&b<=n)
                hough_space(abr)=hough_space(abr)+1;
            end
        end
    end
end
max_para=max(max(max(hough_space)));
index=find(hough_space>=max_para*p);
length=size(index);
hough_circle=false(mn);
for i=1:ecount
    for k=1:length
       par3=floor(index(k)/(m*n))+1;
       par2=floor((index(k)-(par3-1)*(m*n))/m)+1;
       par1=index(k)-(par3-1)*(m*n)-(par2-1)*m;
       if((rows(i)-par1)^2+(cols(i)-par2)^2<(r_min+(par3-1)*step_r)^2+5&&(rows(i)-par1)^2+(cols(i)-par2)^2>(r_min+(par3-1)*step_r)^2-5)
           hough_circle(rows(i)cols(i))=true;
           
       end
    end
end
for k=1:length
    par3=floor(index(k)/(m*n))+1;
    par2=floor((index(k)-(par3-1)*(m*n))/m)+1;
    par1=index(k)-(par3-1)*(m*n)-(par2-1)*m;
    par3=r_min+(par3-1)*step_r;
    % fprintf(1‘Center %d %d radius %d\n‘par1par2par3);
    para(:k)=[par1par2par3];
end
    
                

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

     文件       1415  2019-11-28 19:21  打靶环数判定\hough_circle.m

     文件        297  2019-11-27 11:18  打靶环数判定\Lab1_1.m

     文件         97  2019-11-29 18:07  打靶环数判定\Lab1_2.m

     文件        255  2019-11-27 11:27  打靶环数判定\Lab1_3.m

     文件        714  2019-11-27 11:47  打靶环数判定\Lab2_1.m

     文件        420  2019-11-28 19:43  打靶环数判定\Lab2_2.m

     文件        443  2019-11-28 19:49  打靶环数判定\Lab3_1.m

     文件        592  2019-11-29 09:11  打靶环数判定\Lab3_2.m

     文件        722  2019-11-29 09:23  打靶环数判定\Lab3_3.m

     文件       1385  2019-11-29 18:26  打靶环数判定\Lab3_4.m

     文件      39212  2019-11-25 21:21  打靶环数判定\Target.jpg

     文件      39225  2019-11-27 11:30  打靶环数判定\Target1.jpg

     文件      39289  2019-11-29 10:03  打靶环数判定\Target1_11.jpg

     文件      39367  2019-11-29 14:37  打靶环数判定\Target1_6.jpg

     文件      39308  2019-11-29 18:01  打靶环数判定\Target1_78.jpg

     文件      39335  2019-11-29 17:48  打靶环数判定\Target1_8.jpg

     目录          0  2020-04-08 15:08  打靶环数判定

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

               242076                    17


评论

共有 条评论