Optical character recognition(ocr)

Hi. I will be doing an autocropping of images. was it possible to do rgb->grayscale->binary+autocropping without any image processing in between? example like adjusting of brightness, morph operation? if so, why? thanks!
newbie

답변 (2개)

Walter Roberson
Walter Roberson 2012년 11월 6일

0 개 추천

There are some images that can be cropped that way. There are others that cannot. For example one might have a page that has both text that is black on white, and text that is white on black.

댓글 수: 4

Esther
Esther 2012년 11월 6일
i see! how about when all my images were black(object) on white(background)?
Walter Roberson
Walter Roberson 2012년 11월 6일
Definitely black on white, and no stray gray anywhere in the picture, and even illumination with no shadows? And no extraneous blobs such as ink smudges ?
Image Analyst
Image Analyst 2012년 11월 6일
I didn't even know what her question meant. What does black-on-white or white-on-black have to do with whether you can autocrop or do those 3 operations without any other image processing in between? Nothing. I think there's some implied question that she never asked, like "Look at my image...how can I segment out the characters and do OCR on them?" - but she didn't ask that, or even provide an image for us to look at. Maybe this would help: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Walter Roberson
Walter Roberson 2012년 11월 6일
My Magic 8-Ball had a spare question left ;-)

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

Image Analyst
Image Analyst 2012년 11월 6일

0 개 추천

Yes you can do just those operations, with no additional image processing in between:
grayImage = rgb2gray(rgbImage);
binaryImage = grayImage > thresholdValue;
croppedImage = binaryImage(row1:row2, column1:column2);
There, that's proof. I don't see that any additional explanation as to "Why?" is needed since it's rather self explanatory.

댓글 수: 3

Esther
Esther 2012년 11월 6일
편집: Image Analyst 2012년 11월 6일
was that auto thresholding? i am doing manually.
grayImage = rgb2gray(rgbImage);
binaryImage = im2bw(grayImage,0.2);
croppedImage = binaryImage(row1:row2, column1:column2);
will it be like this?
Depends on how you define manually and automatic. Either way a threshold has to be defined somehow. You can either do it by setting some value like
thresholdValue = 51;
or you can get it from some function like im2bw where you passed it .2, which is 0.2*255 = 51. Either way you're specifying 51 as the threshold. You can use graythresh() if you want it to be some value that varies depending on the image histogram. Again, it all comes down to what YOU define as manual versus automatic.
Walter Roberson
Walter Roberson 2012년 11월 6일
If one was trying to OCR a badly photocopied page that had borders that went grey (or even black), then this simple processing might not be sufficient.

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

질문:

2012년 11월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by