From: Gumah on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <03954a40-ca06-4633-bc94-cc5a05d0ae73(a)n31g2000vbd.googlegroups.com>...
> 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.
Hi again .. and thanks again !!
should I sum rows or columns?? I think in order to find the empty column, (where I want to add another column), I should sum the columns whenever the sum =0 that mean empty column.. one more question .. how to insert new empty column beside the exist empty column..
From: Walter Roberson on
ImageAnalyst wrote:
> 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.

Probably slightly more efficiently:

horizontalProfile = any(binaryImage);
zeroIndexes = find(~horizontalProfile);
From: Gumah on

Walter Roberson <roberson(a)hushmail.com> wrote in message <hq6706$drg$1(a)canopus.cc.umanitoba.ca>...
> ImageAnalyst wrote:
> > 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.
>
> Probably slightly more efficiently:
>
> horizontalProfile = any(binaryImage);
> zeroIndexes = find(~horizontalProfile);

Thanks Walter Roberson for ur feedback
I already managed to find the empty column in the binary image .. my question now how to insert another empty column beside the exiting one .. in other words .. how to add new column inside an array in Matlab??
From: Gumah on

Walter Roberson <roberson(a)hushmail.com> wrote in message <hq6706$drg$1(a)canopus.cc.umanitoba.ca>...
> ImageAnalyst wrote:
> > 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.
>
> Probably slightly more efficiently:
>
> horizontalProfile = any(binaryImage);
> zeroIndexes = find(~horizontalProfile);

Thanks Walter Roberson for ur feedback
I already managed to find the empty column in the binary image .. my question now how to insert another empty column beside the exiting one .. in other words .. how to add new column inside an array in Matlab??
From: ImageAnalyst on
Gumah:
I don't know why you think you should sum over columns to find an
empty column. Think about it. Columns are vertical. So you need to
sum vertically, so that means you need to sum over the rows (vertical)
direction. But anyway, Walter's suggestion of any() is better so use
that. I usually forget about that handy function but it comes in
useful sometimes. Here's some code to insert a vertical stripe of
zeros, once you have figured out where to put it and how wide you want
it:
(You might have to join some long lines that get split into two by the
newsreader.)



% Read in standard MATLAB gray scale demo image.
grayImage = imread('cameraman.tif');
[rows columns numberOfColorBands] = size(grayImage);
subplot(1, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', 20);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

% Insert a column of zeros
numColsToInsert = 10;
startingColumn = 128;
newImage = [grayImage(:, 1:startingColumn) zeros(rows,
numColsToInsert) grayImage(:, startingColumn+1:end)];
subplot(1, 2, 2);
imshow(newImage, []);
title('Image with stripe in columns 128-137', 'FontSize', 20);