How can I automatic number plate recognition using hough lines ?

1 view (last 30 days)
% code
im = imread('test.jpg');
I= rgb2gray(im);
BW = edge(I,'canny');
imtool(BW)
[H,T,R] = hough(BW);
imshow(imadjust(mat2gray(H)),[],'XData',T,'YData',R,...
'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on
colormap(hot), colorbar
P = houghpeaks(H, 4,'NHoodSize',[1 1],'threshold',ceil(0.5*max(H(:)))); % 'NHoodSize',[1 1],
lines = houghlines(BW,T,R,P,'FillGap',6,'MinLength',40);
x = T(P(:,2)); y = R(P(:,1));
plot(x,y,'s','color','blue');
% Find lines and plot them
figure;
imagesc(im);hold on;colormap gray;
axis image;
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow');
plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
%2 ' ler kalınlık
% Determine the endpoints of the longest line segment
len = norm(lines(k).point1 - lines(k).point2);
if ( len > max_len)
max_len = len;
xy_long = xy;
end
end
% highlight the longest line segment
plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','blue');
This code don't find plate area. For Exmample ;
How can I solve this problem ?

Accepted Answer

Image Analyst
Image Analyst on 1 Dec 2014
I don't know if that's a good algorithm or not (apparently not!). You can' tjust assume the longest line in an image is the license plate - it could be a billboard or virtually anything else. But luckily for you, this is a solved problem. We already have police cars here with cameras that automatically scan every plate to the front or right of the patrol car, compare it to a database of wanted/stolen cars, and alert the officers if necessary. Several companies already make this kind of software. No need to reinvent the algorithm. I imagine you'll find better, more robust algorithm in the published literature:
16.7.2.5 License Plate Recognition, Extraction, Analysis
  1 Comment
Adrian
Adrian on 1 Dec 2014
I agree your comment but I must be. My topic is hough line , so must be use hough line

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!