Why it is showing error?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
close all;
clear all;
im = imread(' Number Plate Images/ image1.png');
imgray = rgb2gray(im);
imbin = imbinarize(imgray);
im = edge(imgray, 'prewitt');
% Below steps are to find location of number plate
Iprops = regionprops(im,'BoundingBox','Area', 'Image');
area = Iprops.Area;
count = numel(Iprops);
maxa= area;
boundingBox = Iprops.BoundingBox;
for i = 1:count
if maxa < Iprops(i).Area
maxa = Iprops(i).Area;
boundingBox = Iprops(i).BoundingBox;
end
end
im = imcrop(imbin, boundingBox);
im = bwareaopen(~im, 500);
[h, w] = size(im);
imshow(im);
Iprops = regionprops(im,'BoundingBox','Area', 'Image');
count = numel(Iprops);
noPlate = [];
for i=1:count
ow = length(Iprops(i).Image(1,:));
oh = length(Iprops(i).Image(:,1));
if ow<(h/2) && oh>(h/3)
letter = Letterc(Iprops(i).Image);
noPlate = [noPlate letter];
end
end
1 Kommentar
Geoff Hayes
am 11 Okt. 2019
Kartikey - is line 20
boundingBox = Iprops(i).BoundingBox;
? It seems fine.. I do wonder about
area = Iprops.Area;
count = numel(Iprops);
maxa= area;
boundingBox = Iprops.BoundingBox;
What are the dimensions of maxa and boundingBox when they are initialized? Are they scalars or arrays? If arrays, will this be a problem when doing the comparison at
if maxa < Iprops(i).Area
?
Antworten (1)
Geoff Hayes
am 11 Okt. 2019
Kartikey - similar to one of your other questions, there is a special character at the line where you are doing the assignment. If, in Linux, I use cat -t yourFileName.m on the above code, then I see
for i = 1:count
if maxa < Iprops(i).Area
maxa = Iprops(i).Area;
? boundingBox = Iprops(i).BoundingBox;
end
end
that there is a question mark on that line. I would delete this line and re-type the assignment.
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!