采用图像增强,二值/边缘检测对跑道图预处理,用radon变换检测跑道线,radon反变换得结果

MATLAB的radon变换检测跑道线
在这里插入图片描述

①预处理:图像增强、消噪、分割、边缘化;
②Radon变换:边缘图像作Radon变换
③直线检测:搜索变换域内局部最大值(亮点) , 根据识别规则, 检测目标直线变换域参数, 确定目标类型
④直线拟合。
⑤输出结果。

I=imread('runway.jpg');
imshow(I);
I1=I(:,:,1);%提取红色分量
I2=I(:,:,2);%提取绿色分量
I3=I(:,:,3);%提取蓝色分量
I1=histogram(I1);   %构造的函数
I2=histogram(I2);
I3=histogram(I3);
c=cat(3,I1,I2,I3);  %cat用于构造多维数组
subplot(1,2,1);imshow(I),title('原图');
subplot(1,2,2);imshow(c),title('均衡化后图像');

I=rgb2gray(c); %读入图像
J=mat2gray(I); %转换为灰度图像
[m,n]=size(J);
a=zeros(m,n);
for i=57:m;
    for j=1:n;
        a(i,j)=J(i,j);
    end
end
for i=1:55;
    for j=1:n;
        a(i,j)=0.35;
    end
end
J=a;
BW=edge(J); %获取边缘
figure;subplot(121);imshow(J);
subplot(122);imshow(BW);
theta=0:179; %角度
[R, xp]=radon(BW, theta); %Radon变换
figure;imagesc(theta, xp, R); %绘制各个角度变换结果
colormap(hot); %设置调色板
colorbar; %添加颜色条

在这里插入图片描述

image=imread('runway.jpg');
imagegray=rgb2gray(image);
subplot(131), imshow(image),title('原图');
R=image(:,:,1);
imagegray(R<200)=0;
imagegray (R>=200 )=255;
[r,c]=size(imagegray);
L=bwlabel(imagegray,8);
   for i=1:170 
       if sum(sum(L==i))<150
           L(L==i)=0;
       else
           L(L==i)=1;
       end
end
subplot(132) , imshow(L),title('跑道模板');
I=L;
J=mat2gray(I); %转换为灰度图像
[m,n]=size(J);
% subplot(131),imshow(image);
grayin=J;
thresh = graythresh(grayin);  
I2 = im2bw(grayin,190/255);
figure,imshow(I2);
theta=0:1:180;
[R1,X1]=radon(I2,theta);
%subplot(131),imagesc(theta,X1,R1),title('间隔10°投影的radon变换曲线');
colormap(hot); %设置调色板
colorbar; %添加颜色条
[N,M]=size(R1);
R2=R1;
R2(R1<6)=0;
result=iradon(R2,theta);
figure,imshow(result),title('123');

在这里插入图片描述
支持可以关注我哦,持续分享编写的代码。

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

火球2号

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值