code for horizontal projection profile of an image
Show older comments
hello friends, to perform skew detection and correction, iam using horizontal projection profile. so i need the code for horizontal projection profile to segment lines and i need the code for horizontal projection profile of each word, for image containing handwritten characters.
1 Comment
Oleg Komarov
on 6 Aug 2012
Please review these guidelines and ask a specific question: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
Answers (4)
Image Analyst
on 6 Aug 2012
1 vote
First pick an algorithm from section 23 of the Vision Bibliography: http://iris.usc.edu/Vision-Notes/bibliography/contents.html. Then come back here with your MATLAB coding questions.
Hi every one, I have a license plate, now I want to use horizontal projection to segment the license plate into two lines. Please help me, Thanks you
1 Comment
Image Analyst
on 2 Dec 2015
verticalProjection = mean(grayImage, 2);
horizontalProjection = mean(grayImage, 1);
Rujal
on 22 Jan 2016
1 vote
how to plot horizontal projection horizontally ? I didn't get idea.
5 Comments
Walter Roberson
on 22 Jan 2016
h_proj = any(any(YourImage,1),3);
stairs(h_proj);
Image Analyst
on 22 Jan 2016
Edited: Image Analyst
on 22 Jan 2016
Did you see my comment above where I go the mean of each row by averaging all the columns together:
verticalProjection = mean(grayImage, 2);
This is projecting horizontally. If you prefer the sum rather than the average, use sum() rather than mean():
verticalProjection = sum(double(grayImage), 2);
Walter Roberson
on 23 Jan 2016
For the purpose of determining occupancy for segmentation of text, you only care if there is or is not data in the row or column, in which case the any() and stairs becomes appropriate. mean() would not be appropriate in such a case: if there only happened to be a single ascender or descender present then the mean would be effectively the background value, but you do not want to cut at such locations for text segmenting.
Image Analyst
on 23 Jan 2016
But what if, in handwriting, descenders in one row dip below some risers in the row below? Those two rows would not be detected as two rows with any(). And with sum() and mean(), the descenders would get clipped. So to be really robust, you'd need something more sophisticated than these simple functions. But I can't spend the time to develop a robust OCR program for anyone.
Walter Roberson
on 23 Jan 2016
You need the ascenders and descenders for proper classification of the characters. Horizontal projection is simply not sufficient for the case where you do not have clean separation between the lines.
Categories
Find more on Startup and Shutdown 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!