Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
This chapter is a practical work of the Traffic signs detection and recognition
and final result.
1. Six axes.
2. Three Button.
3. Six static text.
18
Chapter 3 Practical Work and Results
19
Chapter 3 Practical Work and Results
Steps of implementing:
3.4.1 Extract red pixels from original image and changed to grayscale:
imgRed=imsubtract(imgStart(:,:,1),rgb2gray(imgStart));
3.4.2 Extract blue pixels from original image and changed to grayscale:
imgBlue=imsubtract(imgStart(:,:,3),rgb2gray(imgStart));
20
Chapter 3 Practical Work and Results
imgRedBW=im2bw(imgRed,0.13);
imgBlueBW=im2bw(imgBlue,0.13);
21
Chapter 3 Practical Work and Results
ImgFillRed = imfill(imgRedBW,'holes');
ImgFillBlue = imfill(imgBlueBW,'holes');
22
Chapter 3 Practical Work and Results
ImgDelAreaRed=bwareaopen(ImgFillRed,300);
imgBlueBW=im2bw(imgBlue,0.13);
23
Chapter 3 Practical Work and Results
a. Binary Image without noise (Red) b. Binary Image without noise (Blue)
24
Chapter 3 Practical Work and Results
Output:
f=regionprops(img,'BoundingBox','Area','Perimeter');
2 Square (a*b)-Area) = 0
3 Triangle (a*b)/2)-Area) = 0
25
Chapter 3 Practical Work and Results
rectangle('position',Boxes(i).Box,'EdgeColor','y','LineWidth',3);
26
Chapter 3 Practical Work and Results
3.6 Segmentation
resize=imresize(subImage,[128,128]);
27
Chapter 3 Practical Work and Results
3.7 Recognition
grayImage = rgb2gray(resize);
cannyImage = edge(grayImage,'canny');
img=struct('edge',[],'name',[]);
rootDir = pwd;
imgFiles = dir(fullfile(rootDir,'Train','*.jpg'));
for i=1:size(imgFiles,1)
RGB = imread(strcat(fullfile(rootDir,'Train/'),imgFiles(i).name));
name= strtok(imgFiles(i).name,'.');
img(i).name= strtok(name,'(');
grayImage = rgb2gray(RGB);
cannyImage = edge(grayImage,'canny');
img(i).edge=cannyImage;
end
28
Chapter 3 Practical Work and Results
3.7.3 Match extracted signs with database and getting information about sign
size(find(imgRec(j).edge~=cannyImage),1)<500;
29