From: Gumah on
Hi all.. I am working with word segmentation. I need to increase the
space between words in binary image .. to do so I am thinking of
adding a column of 0 pixels whenever 0 pixels is exist in the binary
image.. any one know how to do that??
From: ImageAnalyst on
On Apr 14, 12:31 am, Gumah <alrjele2...(a)gmail.com> wrote:
> Hi all.. I am working with word segmentation. I need to increase the
> space between words in binary image .. to do so I am thinking of
> adding a column of 0 pixels whenever 0 pixels is exist in the binary
> image.. any one know how to do that??
------------------------------------------------------------
Something like this (untested)
b = [a(1:col, :) zeros(size(a, 1), numColsToInsert) a(col+1, :)]
where col is the last row, just before the column where you want to
insert a column

Though I'm not sure why this is necessary. Perhaps you can post your
image and explain why it's needed.
From: M Ladderman on
This can also be handy to use with imclearborder() because sometimes you can only want to remove one part of the border

for example

sizeBinary=size(FinalBinary);
sizeBinary=sizeBinary(:,1);
zero=zeros([sizeBinary 5],'double');
FinalBinary=[FinalBinary zero];
figure, imshow(FinalBinary);
FinalBinary = imclearborder(FinalBinary, 26);

ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <3a2ccf11-ba20-4c4f-b583-393328f701d1(a)e7g2000yqf.googlegroups.com>...
> On Apr 14, 12:31 am, Gumah <alrjele2...(a)gmail.com> wrote:
> > Hi all.. I am working with word segmentation. I need to increase the
> > space between words in binary image .. to do so I am thinking of
> > adding a column of 0 pixels whenever 0 pixels is exist in the binary
> > image.. any one know how to do that??
> ------------------------------------------------------------
> Something like this (untested)
> b = [a(1:col, :) zeros(size(a, 1), numColsToInsert) a(col+1, :)]
> where col is the last row, just before the column where you want to
> insert a column
>
> Though I'm not sure why this is necessary. Perhaps you can post your
> image and explain why it's needed.
From: Gumah on
On Apr 14, 6:24 pm, ImageAnalyst <imageanal...(a)mailinator.com> wrote:
> On Apr 14, 12:31 am, Gumah <alrjele2...(a)gmail.com> wrote:> Hi all.. I am working with word segmentation. I need to increase the
> > space between words in binary image .. to do so I am thinking of
> > adding a column of 0 pixels whenever 0 pixels is exist in the binary
> > image.. any one know how to do that??
>
> ------------------------------------------------------------
> Something like this (untested)
> b = [a(1:col, :) zeros(size(a, 1), numColsToInsert) a(col+1, :)]
> where col is the last row, just before the column where you want to
> insert a column
>
> Though I'm not sure why this is necessary.  Perhaps you can post your
> image and explain why it's needed.

HI ImageAnalyst Thanks for your feedback .. Actually I am designing
Matlab function that can segment handwritten text line into words ..
my code could not some words due to overlapping because the space
between some words is so narrow .. if I can maximize that space which
contain at lest one column of 0 pixels for sure I think I will be able
to do the segmentation.. I need to make a code that scan the binary
image .. when ever 0 pixels column is fouded it will add one more 0
column .. waiting your commands !
From: ImageAnalyst on
OK, I command you to sum your binary image along the rows.
horizontalProfile = sum(binaryImage, 1);
Now find where this is zero
zeroIndexes = find(horizontalProfile == 0);
that will tell you which columns are totally zero all the way up and
down. Any index not listed in zeroIndexes will be where there is some
handwriting in that column.