从航拍图像中检测道路和车辆

Road and vehicle detection from aerial images

我目前正在使用 MATLAB 从 aerial/satellite 图像中检测 roads/highways。我根据道路及其周围环境的强度差异的概念编写了相同的代码。但是效率并不是很高,因为它也在检测非道路实体。与此同时,我还将检测这些道路上的车辆,然后尝试计算道路的宽度。你能帮我改进我目前的方法或建议一种新方法吗?

提前致谢! :)

我已附上我的 MATLAB 代码以供审核。

clc
clear all
close all

a=rgb2gray(imread('freeway24.tif'));

a2=mean(a);
t=min(a2);

b=lt(a,t);
[row_b, column_b]=size(b);

for i=1:row_b
for j=1:column_b
    if b(i,j)~=1
        b(i,j)=0;
    else
        b(i,j)=255;
    end
end
end

bw0=bwareaopen(b,50);
bw1=bwmorph(bw0,'clean');
bw2=bwmorph(bw1,'majority');
bw3=bwmorph(bw2,'fill');
bw4=imfill(bw3,'holes');

[row_final,column_final]=size(bw4);
bw_final=zeros();
for i=1:row_final
for j=1:column_final
    if bw4(i,j)==1
        bw_final(i,j)=a(i,j);
    else
        bw_final(i,j)=0;
    end
end
end

subplot(1,2,1);
imshow(a);
title('Original Image');
subplot(1,2,2);
imshow(bw_final);
title('After detection');

注意:由于我没有 10 个声望点,我无法 post 输入图像。我已将 link 上传到此处的图片。 https://drive.google.com/open?id=0B0MIQKh4Irk8MVlXYnhIcmpxTG8

我建议你多研究计算机视觉,尤其是这些 matlab 函数:imclose, the imerode, the imdilate, and the bwareaopen。 下面介绍了一个可以帮助您的代码。您只需在最后一个 imshow 之前添加它。

% Calculate disk of radius 2 pixels, 4 pixels diameter
se = strel('disk', 2);
% Connect the white pixels that are less than 4 pixels apart
bw_final = imclose(bw_final, se);
% Connect the black pixels that are less than 4 pixels apart
bw_final = ~imclose(~bw_final, se);

% Calculate 2% of the image pixels
num2Percent = round(numel(bw_final)/50);
% Remove white area smaller than 2%
bw_final = bwareaopen(bw_final, num2Percent);
% Remove black area smaller than 2%
bw_final = ~bwareaopen(~bw_final, num2Percent);