Does anyone have any sample on MATLAB coding for Number plate recognition?

-Image captured
-RGB to grayscale
-Image filtering (edge detection, sobel, laplacian)
-Morpholgy
-Image treshold
-Convert to black & white
-Extract number plate box from image
-character segmentation
-character recognition (OCR)

 採用された回答

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 11 月 19 日

1 投票

7 件のコメント

Ahmed
Ahmed 2014 年 11 月 19 日
thank you Dr.
Ahmed
Ahmed 2014 年 11 月 19 日
編集済み: Image Analyst 2014 年 11 月 19 日
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
button = menu('Use which demo image?', 'CameraMan', 'Moon', 'Eight', 'Coins', 'Pout');
if button == 1
baseFileName = 'cameraman.tif';
elseif button == 2
baseFileName = 'moon.tif';
elseif button == 3
baseFileName = 'eight.tif';
elseif button == 4
baseFileName = 'coins.png';
else
baseFileName = 'pout.tif';
end
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
grayImage = grayImage(:, :, 2); % Take green channel.
end
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Give a name to the title bar.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
% Compute Laplacian
laplacianKernel = [-1,-1,-1;-1,8,-1;-1,-1,-1]/8;
laplacianImage = imfilter(double(grayImage), laplacianKernel);
% Display the image.
subplot(2, 2, 2);
imshow(laplacianImage, []);
title('Laplacian Image', 'FontSize', fontSize);
% Compute the sharpened image when you can get by using imfilter or conv2 and the
% kernel [-1,-1,-1;-1,8,-1;-1,-1,-1], or else if you have the Laplacian already,
% simply add the original image to the laplacianImage.
sharpenedImage = double(grayImage) + laplacianImage;
% Display the image.
subplot(2, 2, 3);
imshow(sharpenedImage, []);
title('Sharpened Image', 'FontSize', fontSize);
% Computer Sobel image
[magnitudeImage, directionImage] = imgradient(grayImage, 'Sobel');
% Display the original gray scale image.
subplot(2, 2, 4);
imshow(magnitudeImage, []);
title('Sobel Image', 'FontSize', fontSize);
p/s : sir, I believe this is your coding. I wonder why the image 'sobel' does not appear when this code is executed?
Image Analyst
Image Analyst 2014 年 11 月 19 日
It does show up. I just copied and pasted and ran, and here is the result:
It's right there in the lower right corner. Why do you say it doesn't show up?
Ahmed
Ahmed 2014 年 11 月 19 日
Oh, maybe the matlab software i used have some problem or the version is quite old. I just get this result. thank you for your response. It help much
Image Analyst
Image Analyst 2014 年 11 月 19 日
What version of MATLAB do you have? If you have an old version and don't have imgradient(), it should have thrown an exception. Did you see any red error text?
Ahmed
Ahmed 2014 年 11 月 19 日
編集済み: Image Analyst 2014 年 11 月 19 日
MATLAB 7.6.0 (R2008a). yes sir, exactly. when i executed the code, the red error text appeared.
??? Undefined function or method 'imgradient' for input arguments of type 'uint8'.
Image Analyst
Image Analyst 2014 年 11 月 19 日
It's not available in your 6 year old version. Contact the Mathworks about upgrading. Or else write it yourself. You might be able to get by with a DOG filter and I've attached a demo.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索

質問済み:

2014 年 11 月 19 日

編集済み:

2014 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by