필터 지우기
필터 지우기

How to extract the plate area only from black background

조회 수: 2 (최근 30일)
mohamed
mohamed 2012년 8월 3일
댓글: Rinku 2014년 12월 31일
Hi, i want to know how to crop the plate area only from the image shown below my code takes the RGB image & outputs this image, so i need only a way to extract the numbers area only here is the output picture
thanks in advance

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 8월 3일
II=im2bw(I);
s=regionprops(II,'Area','BoundingBox');
[ii,ii] = sort([s.Area],'descend');
out = imcrop(I,s(ii(2)).BoundingBox);
  댓글 수: 2
mohamed
mohamed 2012년 8월 3일
편집: mohamed 2012년 8월 3일
thanks for you all i did it at last thanks again but u must fix your code like this:
II=im2bw(I);
s=regionprops(II,'Area','BoundingBox');
[~,ii] = sort([s.Area],'descend');
out = imcrop(I,s(ii(1)).BoundingBox);
Rinku
Rinku 2014년 12월 31일
thank you both of you..this code is help me very much..

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

추가 답변 (2개)

Image Analyst
Image Analyst 2012년 8월 3일
You could pass the image into regionprops() and ask for area and eccentricity. The plate will have a lower eccentricity than the lines, and probably but not necessarily a larger area than any/most/all of the lines. But I can't tell that that rectangular blob with a bunch of holes in it in the lower left is not also another license plate. At least for this one particular image, you could get rid of that based on area or FilledArea.

Thomas
Thomas 2012년 8월 3일

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by