NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

function numberPlateExtraction
% NUMBERPLATEEXTRACTION extracts the characters from the input number plate image.

f=imread('car3.jpg'); % Reading the number plate image.
f=imresize(f,[400 NaN]); % Resizing the image keeping aspect ratio same.
g=rgb2gray(f); % Converting the RGB (color) image to gray (intensity).
g=medfilt2(g,[3 3]); % Median filtering to remove noise.
se=strel('disk',1); % Structural element (disk of radius 1) for morphological processing.
gi=imdilate(g,se); % Dilating the gray image with the structural element.
ge=imerode(g,se); % Eroding the gray image with structural element.
gdiff=imsubtract(gi,ge); % Morphological Gradient for edges enhancement.
gdiff=mat2gray(gdiff); % Converting the class to double.
gdiff=conv2(gdiff,[1 1;1 1]); % Convolution of the double image for brightening the edges.
gdiff=imadjust(gdiff,[0.5 0.7],[0 1],0.1); % Intensity scaling between the range 0 to 1.
B=logical(gdiff); % Conversion of the class from double to binary.
% Eliminating the possible horizontal lines from the output image of regiongrow
% that could be edges of license plate.
er=imerode(B,strel('line',50,0));
out1=imsubtract(B,er);
% Filling all the regions of the image.
F=imfill(out1,'holes');
% Thinning the image to ensure character isolation.
H=bwmorph(F,'thin',1);
H=imerode(H,strel('line',3,90));
% Selecting all the regions that are of pixel area more than 100.
final=bwareaopen(H,100);
final=bwlabel(final); % Uncomment to make compitable with the previous versions of MATLAB®
% Two properties 'BoundingBox' and binary 'Image' corresponding to these
% Bounding boxes are acquired.
Iprops=regionprops(final,'BoundingBox','Image');
% Selecting all the bounding boxes in matrix of order numberofboxesX4;
NR=cat(1,Iprops.BoundingBox);
% Calling of controlling function.
r=controlling(NR); % Function 'controlling' outputs the array of indices of boxes required for extraction of characters.
if ~isempty(r) % If succesfully indices of desired boxes are achieved.
I={Iprops.Image}; % Cell array of 'Image' (one of the properties of regionprops)
noPlate=[]; % Initializing the variable of number plate string.
for v=1:length(r)
N=I{1,r(v)}; % Extracting the binary image corresponding to the indices in 'r'.
letter=readLetter(N); % Reading the letter corresponding the binary image 'N'.
while letter=='O' || letter=='0' % Since it wouldn't be easy to distinguish
if v<=3 % between '0' and 'O' during the extraction of character
letter='O'; % in binary image. Using the characteristic of plates in Karachi
else % that starting three characters are alphabets, this code will
letter='0'; % easily decide whether it is '0' or 'O'. The condition for 'if'
end % just need to be changed if the code is to be implemented with some other
break; % cities plates. The condition should be changed accordingly.
end
noPlate=[noPlate letter]; % Appending every subsequent character in noPlate variable.
end
fid = fopen('noPlate.txt', 'wt'); % This portion of code writes the number plate
fprintf(fid,'%sn',noPlate); % to the text file, if executed a notepad file with the
fclose(fid); % name noPlate.txt will be open with the number plate written.
winopen('noPlate.txt')

% Uncomment the portion of code below if Database is to be organized. Since my
% project requires database so I have written this code. DB is the .mat
% file containing the array of structure of all entries of database.
% load DB
% for x=1:length(DB)
% recordplate=getfield(DB,{1,x},'PlateNumber');
% if strcmp(noPlate,recordplate)
% disp(DB(x));
% disp('*-*-*-*-*-*-*');
% end
% end

else % If fail to extract the indexes in 'r' this line of error will be displayed.
fprintf('Unable to extract the characters from the number plate.n');
fprintf('The characters on the number plate might not be clear or touching with each other or boundries.n');
end
end
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.