How to localize the vehicle plate with Hough Transform?

2 views (last 30 days)
I want to localize the plate of the vehicle and crop it. And the cropped image will be used in character segmentation phase. But the code always give the wrong result.
here is the code..
%# read and crop image
I = imread('DSC_0512.JPG');
%# egde detection
BW = edge(rgb2gray(I), 'canny');
%# hough transform
[H T R] = hough(BW);
P = houghpeaks(H, 4, 'threshold',graythresh(H));
lines = houghlines(BW, T, R, P);
%# show image with lines overlayed, and the aligned/rotated image figure
subplot(121), imshow(I), hold on
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1), xy(:,2), 'g.-', 'LineWidth',2);
end, hold off
I want that the code can applied for many car's image to get the plate location and crop it.
Here is example of the images.
Any suggestion?

Answers (0)

Community Treasure Hunt

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

Start Hunting!