character segmentation

조회 수: 5 (최근 30일)
Ashish
Ashish 2011년 4월 25일
댓글: ezhil K 2019년 2월 10일
hi, i have obtained this code from a website,for character segmentation, i am unable to understand a particular line in this code , could any body explain me...
code:-
clear all;
close all;
I = imread('plate.jpg');
BW = im2bw(I, 0.9);
BW = ~BW;
stats = regionprops(BW);
for index=1:length(stats)
if stats(index).Area > 200 && stats(index).BoundingBox(3)*stats(index).BoundingBox(4) < 30000
x = ceil(stats(index).BoundingBox(1))
y= ceil(stats(index).BoundingBox(2))
widthX = floor(stats(index).BoundingBox(3)-1)
widthY = floor(stats(index).BoundingBox(4)-1)
subimage(index) = {BW(y:y+widthY,x:x+widthX,:)};
figure, imshow(subimage{index})
end
end
what does this line do:
if stats(index).Area > 200 && stats(index).BoundingBox(3)*stats(index).BoundingBox(4) < 30000

채택된 답변

Walter Roberson
Walter Roberson 2011년 4월 25일
For a 2 dimensional image, BoundingBox(3) will be the x width and BoundingBox(4) will be the y width of the bounding box.
The Area is the actual number of pixels in the region; the product of the widths is the number of pixels that are within the bounding box.
  댓글 수: 6
vinod ch
vinod ch 2014년 3월 2일
편집: vinod ch 2014년 3월 2일
what does the boundingBox contains can you explain it briefly about this code... i mean how it was able to detect exactly it is the character and on what parameters it separated them. can you explain me
ezhil K
ezhil K 2019년 2월 10일
I have used the same code.But,I get error as follows:
Error:
Reference to non-existent field 'Area'.
Error in Shi_tomashi (line 142)
if stats(index).Area > 100 && stats(index).BoundingBox(3)*stats(index).BoundingBox(4) < 30000
How should I resolve this?

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

추가 답변 (1개)

SATYAVIR SINGH KUNTAL
SATYAVIR SINGH KUNTAL 2011년 4월 26일
@ashish.. could u give me the link of the site from which u got this piece of code... thanxx..
  댓글 수: 1
Ashish
Ashish 2011년 4월 26일
Here is the link:
http://stackoverflow.com/questions/5305712/how-to-perform-character-segmentation-in-matlab
there is a sample image along with the code.

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by