how to get potential segmentation columns(PSC) in an handwritten image?

hello! im trying to segment individual characters of handwritten image . for that i have pre-procesed the image like binarisation , thinning. now my next step is PSC ( each column in the word image, for which the sum of foreground white pixels is 0 or 1 ).
in the attached image i have achieved till step (C) . after doing PSC the output will be as shown in step (d).
how do i achieve this ? please help me with the code. thank you

Respuestas (1)

Take the sum vertically, then threshold at 1 or less:
horizontalProfile = sum(double(binaryImage), 1); % double may not be required - not sure.
logicalSpaceIndexes = horizontalProfile <= 1;
Now you have a logical vector that tells you whether a column has 0 or 1 binary pixel in it. If you want actual indexes, you can do
actualSpaceIndexes = find(logicalSpaceIndexes);
That may be more or less convenient to use, depending on what you want to do with the location information and how you want to use it.

14 comentarios

Thank you sir.We are getting PSC.How to print All PSCs over-segmenting the word image in red color?? something like the below image!
You can use fill() or patch(). Just give the 4 corner coordinates of each rectangle.
thanks for the reply sir. I'll try with further steps and get back to you.
how to vertically cut the image attached based on PSC? please refer my attached code. thank you
You can use simple indexing, or the imcrop() function.
sir,we are not getting you.we were referring one of the papers out of the links which you provided.There we got to know by PSC we can achieve character segmentation.NOw our task is draw lines based on PSC and do little modifications and then crop.So,first based on PSC,how do we draw lines as shown in the image (d. in the main figure which is attached along with the question).Please help us with the code to achieve this.Thank You
I was answering sindhu where he wanted to "cut" the image. And he already has the left and right columns because you can see he already put up red rectangles in his image at the top of this page. And it sounds like you also already have the "PSC" segmentation (where the columns are). So assuming the columns are col1 and col2, then to cut out (crop) a rectangle of all the rows between column col1 and col2 you do this:
croppedImage = grayImage(:, col1:col2);
sindhu is a girl.we are in the same team :) and no sir,she has asked in the question that she should get the red rectangles ,to visualize she has put up the image .she has not the red rectangles.So we are asking you how to put up that red rectangles.
that's fine sir.we are working on the implementation part,its just that we could'nt find the solution for the problems like this,so seeking your help :)
she has clearly mentioned below the image that she has achieved till (c) in the image.Please see that
Sorry, I didn't know she was a girl from the name (not my native language) and I didn't know you were on the same team. To put up red rectangles over the spaces, you can use fill() or patch(). But that requires that you know the coordinates of the vertices. Hopefully by following the algorithm in the paper you can find the columns that define the start and stop of the red zones. Then just use patch() or fill().
Sir,the algorithm in the paper says like this.
step 3:This image is now converted from binary format to a RGB format as shown in Fig(c).
Now, it becomes computationally easier to display the PSC (Potential Segmentation Columns) in different color other than black and white.
Step 4: All PSCs over-segmenting the word image are printed in red color as shown in Fig.(d). It is clear from Fig.(d) that each column in the word image, for which the sum of foreground white pixels is 0 or 1, is a PSC and vertically cuts the word image.
Please do refer the attached code
After converting to RGB ,what should be done according to the algorithm??
Please do help me.Thank you
Fig (c) and Fig (d) are the images in the main question
I don't know why you want or need an RGB image. That image is not really needed for segmentation, it's just for your information/curiosity. To just indicate those red zones, just use patch() or fill() - it's easy.
Yes sir i used rectangle function to indicate red lines.Now for one image i'm specifying the co-ordinates.But how to indicate those red lines for when different images is given as input?? I mean on what basis, the red lines should be drawn?sorry for asking too many questions.

Iniciar sesión para comentar.

Preguntada:

el 21 de Dic. de 2015

Comentada:

el 6 de En. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by