필터 지우기
필터 지우기

how to detect the object with character written on it and then crop the object out?i wanted to detect the car plate region..help me out..thks..and here is my code

조회 수: 2 (최근 30일)
i = imread('c2.jpg');
%image of c2 can be found in this link---https://www.google.com/search?q=car+plate+malaysia&source=lnms&tbm=isch&sa=X&ei=CpfjUZ_zNIaCrgee_YCoDw&sqi=2&ved=0CAcQ_AUoAQ&biw=1366&bih=649#facrc=_&imgdii=_&imgrc=vgo8fPgcyvixkM%3A%3BrlU7pCzBBN687M%3Bhttp%253A%252F%252Fwww.thecar.com.my%252Fimages%252Fimg_car%252F20071005jkschenA1124.JPG%3Bhttp%253A%252F%252Fwww.thecar.com.my%252Fcar0001808%3B450%3B337
i1 = rgb2gray(i);
i11 = imadjust(i1);
i2 = edge(i11,'canny',0.4);
figure,imshow(i2);
i22 = imclose(i2,se);
figure,imshow(i2);title('canny');
figure,imshow(i22);title('close line');
se = strel('square',2);
i3 = imdilate(i22,se);
i4 = imfill(i3,'holes');
[Ilabel num] = bwlabel(i4);
BW2 = bwareaopen(i4, 1620);
%d=bwmorph(BW2,'remove');
d=medfilt2(BW2,[3 3]); %median filter
e=imclearborder(d, 4);
[L,NUM]=bwlabel(e,4);
disp(L);
subplot(1,8,1);imshow(i1);title('gray');
subplot(1,8,2);imshow(i2);title('canny');
subplot(1,8,3);imshow(i3);title('dilate');
subplot(1,8,4);imshow(i4);title('fill holes');
subplot(1,8,5);imshow(BW2);title('connected');
subplot(1,8,6);imshow(d);title('median filter');
subplot(1,8,7);imshow(e);title('clear border');
subplot(1,8,8);imshow(i11);title('adjust');
for i=1:NUM
figure,imshow(L==i),title('object i');
% figure,imhist(L==i);
%J = imcrop(L==i,[60 40 100 90]);
% figure,imshow(X2);title('cropped');
pause(1);
end
disp(num);
  댓글 수: 3
Bob
Bob 2013년 7월 23일
i ady upload the .m file and image to my file exchange.can check over there..thks^^

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by