Clear Filters
Clear Filters

I am working on a project called vehicle number plate recognition. The approach I have followed requires detection of the plate, segmentation then matching.I am having problem in character matching. I have pasted the concerned code here. Kindly help

2 views (last 30 days)
[labels1,numOfDigits1] = bwlabel(carplateBW,8);
%%Check Statistics
for loop = 1:1:numOfDigits1
total(loop) = bwarea(find(labels1==loop));
end
%%Morphologically open binary image (remove small objects)
carplateBWFilter1 = bwareaopen(carplateBW,3300);
figure,imshow(carplateBWFilter1);
carplateBWFilter=~carplateBWFilter1;
%dim = size(carplateBWFilter);
%col = round(dim(2)/2)-90;
%row = min(find(carplateBWFilter(:,col)))
%boundary = bwtraceboundary(carplateBWFilter,[row, col],'N');
%figure,imshow(carplateBWFilter);
%hold on;
%plot(boundary(:,2),boundary(:,1),'g','LineWidth',3);
[labels2,numOfDigits2] = bwlabel(carplateBWFilter,8);
figure,image(labels2)
for loop = 1:numOfDigits2
[r,c] = find(labels2==loop);
offset = 5;
rmin = min(r) - offset;
rmax = max(r) + offset;
cmin = min(c) - offset;
cmax = max(c) + offset;
digitsBW{loop} = imcrop(carplateBWFilter,[cmin rmin (cmax-cmin) (rmax - rmin)]);
img_r=imresize(digitsBW{loop},[42 24]);
figure, imshow(img_r);
%end
create_templates;
comp=[];
load templates
for n=1:36
sem=corr2(templates{1,n},img_r);
comp=[comp sem];
end
vd=find(comp==max(comp));
%*-*-*-*-*-*-*-*-*-*-*-*-*-
if vd==1
letter='A';
elseif vd==2
letter='B';
elseif vd==3
letter='C';
elseif vd==4
letter='D';
elseif vd==5
letter='E';
elseif vd==6
letter='F';
elseif vd==7
letter='G';
elseif vd==8
letter='H';
elseif vd==9
letter='I';
elseif vd==10
letter='J';
elseif vd==11
letter='K';
elseif vd==12
letter='L';
elseif vd==13
letter='M';
elseif vd==14
letter='N';
elseif vd==15
letter='O';
elseif vd==16
letter='P';
elseif vd==17
letter='Q';
elseif vd==18
letter='R';
elseif vd==19
letter='S';
elseif vd==20
letter='T';
elseif vd==21
letter='U';
elseif vd==22
letter='V';
elseif vd==23
letter='W';
elseif vd==24
letter='X';
elseif vd==25
letter='Y';
elseif vd==26
letter='Z';
%*-*-*-*-*
elseif vd==27
letter='1';
elseif vd==28
letter='2';
elseif vd==29
letter='3';
elseif vd==30
letter='4';
elseif vd==31
letter='5';
elseif vd==32
letter='6';
elseif vd==33
letter='7';
elseif vd==34
letter='8';
elseif vd==35
letter='9';
else
letter='0';
end
word=[word letter];
end
fprintf(fid,'Number Plate:-%s\nDate:-%s\n',word,date);%Write 'word' in text file (upper)
word=[];%Clear 'word' variable
end
fclose(fid);

Answers (1)

Image Analyst
Image Analyst on 14 Apr 2012
OK, I helped -- I formatted your code for you. Not sure what else you want. Maybe another tip. Use a short subject line like "License Plate Recognition" and save the long explanations for the body of the message rather than the subject line. Also, you might want to look at normalized cross correlation instead of corr2, like in this thread: http://www.mathworks.com/matlabcentral/answers/24467-identifying-objects-in-a-picture-containing-several-objects You should also look at ways that people have done this successfully in section 16.7.2.5 : http://iris.usc.edu/Vision-Notes/bibliography/contentsmotion-f.html#Motion%20--%20Feature-Based,%20Long%20Range,%20Motion%20and%20Structure%20Estimates,%20Tracking,%20Surveillance,%20Activities

Categories

Find more on Text Analytics Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!