Need help with my program for number plate recognition.

Hi! I need your help. I tried creating a program for number plate recognition.
So to read the letters on number plate i created an array (NewTemplates) which contains images of all alphabets and numbers (all images are of size [42 24]). I tried checking correlation between the letter on number plate with each element of array NewTemplate.
So for checking correlation I've tried following code
for n=1:length(NewTemplates)
cor=corr2(NewTemplates(1,n),snap);
rec=[rec cor];
end
When I run my program it sends an error that both the inputs in corr2 function are of different sizes but I've already resized the input image (snap) to size [42 24] which is the size of my images of alphabets and numbers.
Can you help me to solve its error? Plzzz... It will be of great help. Thanks in advance.

回答 (1 件)

Image Analyst
Image Analyst 2020 年 6 月 12 日

2 投票

What is NewTemplates? Is it a 3-D array, or a cell array? Try this:
whos NewTemplates
rec = [];
for n = 1 : length(NewTemplates)
thisImage = NewTemplates{n}; % Assume NewTemplates is a cell array.
%thisImage = NewTemplates(:, :, n); % This line assumes NewTemplates is a 3-D array of images stacked up.
thisImage = imresize(thisImage, [size(snap, 1), size(snap, 2)])
size(thisImage) % Show what size it is in the command window.
cor=corr2(thisImage,snap);
rec=[rec, cor];
end

9 件のコメント

Image Analyst
Image Analyst 2020 年 6 月 12 日
Are you going to answer my questions??? Did you just forget? And did you also forget to show us the result of the whos command in the command window? And did you forget to try the other option for thisImage I gave below (uncomment it). krishna, you have to help us if we're to help you.
madhan ravi
madhan ravi 2020 年 6 月 12 日
編集済み: madhan ravi 2020 年 6 月 12 日
Didn’t you read sir Image Analysts first line?
Change
n = 1:size(NewTemplates,3);
thisImage = NewTemplates(:,:,n); %rest remain unchanged
krishna singh
krishna singh 2020 年 6 月 13 日
This is the result of whos.
I tried both of your codes but both of them don't work. In case of the code you provided me sir Image analyst, it fails to recognise the letters of number plate and i get 000000 as number plate.
I also edited the code according to Madhan Ravi but then it gives me AAAAAA as my number plate.
P.S.- Sorry for my previous cooment. DO let me know if you need any more info.
Image Analyst
Image Analyst 2020 年 6 月 13 日
So NewTemplates is a single 2-D image, not a collection of a bunch of images in a 3-D stacked image or a cell array. And you're doing
for n=1:length(NewTemplates)
cor=corr2(NewTemplates(1,n),snap);
rec=[rec cor];
end
Now length() is the longest of the two dimensions, so with 42 x 864, it will take 864. So NewTemplates(1,n) is taking the n'th column of that array, which is a 42 row by 1 column vector. So now you're trying to correlate that vector with snap. So is snap a 42 row by 1 column vector also? Or is it a 3-D RGB image you've snapped from a camera? Their sizes probably don't match. What does this show
whos snap
Have you made all your template images into row vectors and stored them as rows in the NewTemplates array?
krishna singh
krishna singh 2020 年 6 月 15 日
I'm attaching screenshots of my code with this comment.
So basically what i've done is i've stored images of alphabets and numbers in a folder named Alpha an then using imread command i've assigned those images to different variables like A for image of letter A.
Then i've stored all those variables in NewTemplates.
Now i've created an function named Letter_Identification and snap is its input argument and i resized it to size [42 24]. It is the size of all the images of alphabets and letters.
Now in third script, first i find the exact location of number plate. Then using iprops command i acces all teh letters on the number plate individually and then give it as input argument to the function Letter_Identification.
Image Analyst
Image Analyst 2020 年 6 月 15 日
Can you zip all your code and images together and attach the zip file?
krishna singh
krishna singh 2020 年 6 月 15 日
It contains all three codes and all the images.
Aliasgar Merchant
Aliasgar Merchant 2020 年 7 月 31 日
Hi Krishna Singh, i am having the exact same issue. Did it get solved?
krishna singh
krishna singh 2020 年 7 月 31 日
Sorry but it didn't get solved. I am trying will let you know when the problem is solved.

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

カテゴリ

ヘルプ センター および File ExchangeLanguage Support についてさらに検索

製品

リリース

R2018a

質問済み:

2020 年 6 月 12 日

コメント済み:

2020 年 7 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by