Need help with my program for number plate recognition.
Afficher commentaires plus anciens
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.
Réponses (1)
Image Analyst
le 12 Juin 2020
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 commentaires
Image Analyst
le 12 Juin 2020
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
le 12 Juin 2020
Modifié(e) : madhan ravi
le 12 Juin 2020
Didn’t you read sir Image Analysts first line?
Change
n = 1:size(NewTemplates,3);
thisImage = NewTemplates(:,:,n); %rest remain unchanged
krishna singh
le 13 Juin 2020
Image Analyst
le 13 Juin 2020
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
le 15 Juin 2020
Image Analyst
le 15 Juin 2020
Can you zip all your code and images together and attach the zip file?
krishna singh
le 15 Juin 2020
Aliasgar Merchant
le 31 Juil 2020
Hi Krishna Singh, i am having the exact same issue. Did it get solved?
krishna singh
le 31 Juil 2020
Catégories
En savoir plus sur Language Support dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



