Why it is showing error?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Geoff Hayes
2019년 10월 11일
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
?
답변 (1개)
Geoff Hayes
2019년 10월 11일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!