How to extract the content between the vertical lines drawn in an image?

Hello, I have drawn the vertical lines and i want to extract the contents in between them.I have uploaded the code and the image also. Please help me with the code.

 Accepted Answer

fullsegments = floor(columns/spacing);
partialsegment = columns - fullsegments * spacing;
segmentwidths = spacing * ones(1,fullsegments);
if partialsegment > 0
segmentwidths(end+1) = partialsegment;
end
segments = mat2cell(BinaryImage, rows, segmentwidths);
Now segments{1}, segments{2} and so on will be the portions between where the lines would be. If the spacing did not exactly divide the number of columns then the segments{end} will be width less than spacing.

10 Comments

Is there any method to put the vertical lines exactly between the letters so that it works for all different images too??
If you have cursive handwriting with connected letters, then exactly where does one letter end and the next begin? And how are you going to determine the boundary between the letters without first having used ocr to determine which letters they are? For example if you have a cursive v joined to a second cursive v, how are you going to tell that apart from a w without having done ocr first?
i agree to the fact sir.considering your point,how to do ocr for cursive handwriting??we are'nt getting how to do.Please help us.
See section 23.4 here: http://www.visionbib.com/bibliography/contentschar.html#OCR,%20Document%20Analysis%20and%20Character%20Recognition%20Systems -- there are tons of papers on it. Sorry, but Walter and I have not read and evaluated them all so we can't recommend one as being the best. We'll let you do that. You can do it just as well as we can. Good luck.
I would not program OCR on cursive writing. The topic does not interest me enough to be worth going through the many many papers on the topic. (Note 1) I would call an already developed code such as http://www.mathworks.com/help/vision/ref/ocr.html
If I wanted to know more about how it was done I would follow the references there to the information about the Tesseract OCR Engine that MATLAB uses.
(Note 1) Yes, I suppose if someone offered me enough money I might consider working on it, but my heart would not be in it.
hello sir,how do i extract the contents when i draw multiple rectangles as attached in the code.Please help me.Thank you
the following is the input image.
If you know where the rectangles are going then just use array indexing.
no sir,we are drawing rectangles dynamically,hence we dont know where those rectangles are going!
Your code has
rectangle('Position',[value 3 2 40],'facecolor','g');
so you do know where the rectangles are going. They are going at row 3, column "value", width 2, height 40. If you prefer to work in the coordinates above, call imcrop() passing in that same vector you are passing in as your Position.
i tried this,
imcrop(binaryImage,[value 3 2 40]);
but im not getting exactly sir.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!