1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| x = imread('Roadside.jpg');
figure(2);
imshow(x);
y = x(:,:,2);
bw = (y>130);
bw1 = bwareaopen(bw,40);% pour supprime toute les image en dessous de 40 pixel
figure(1);
imshow(bw1);
% scanner du cote Droit(recht)
for i1= 450 : 1200
if (bw1(445,i1)>0)
i1
break
end
end
for i2= 450 : 1200
if (bw1(750,i2)>0)
i2
break
end
end
RGBk = uint8(cat(3,bw1,bw1,bw1)*255);
RGBk =insertShape(RGBk,'line',[1,445,1000,445],'color','cyan');
RGBk =insertShape(RGBk,'line',[i1,445,i2,750],'color','red','LineWidth',5);
RGBk =insertShape(RGBk,'line',[1,750,1000,750],'color','cyan');
figure(3)
imshow(RGBk)
% scanner du cote gauche(link - mittel)
for i3= 225: 450
if (bw1(606,i3)>0)
i3
break
end
end
for i4= 225 :450
if (bw1(725,i4)>0)
i4
break
end
end
RGBk1 = uint8(cat(3,bw1,bw1,bw1)*255);
RGBk1 =insertShape(RGBk1,'line',[1,606,1250,606],'color','cyan');
RGBk1 =insertShape(RGBk1,'line',[i3,606,i4,725],'color','yellow','LineWidth',5);
RGBk1 =insertShape(RGBk1,'line',[1,725,1250,725],'color','cyan');
figure(4);
imshow(RGBk1);
% scanner du cote gauche(link)
for i5= 6: 225
if (bw1(436,i5)>0)
i5
break
end
end
for i6= 6 :225
if (bw1(570,i6)>0)
i6
break
end
end
RGBk2 = uint8(cat(3,bw1,bw1,bw1)*255);
RGBk2 =insertShape(RGBk2,'line',[1,436,1250,436],'color','cyan');
RGBk2 =insertShape(RGBk2,'line',[i5,436,i6,570],'color','green','LineWidth',5);
RGBk2 =insertShape(RGBk2,'line',[1,570,1250,570],'color','cyan');
figure(5);
imshow(RGBk2);
if (bw1(570,i5)== 0)
end |
Partager