Prev: I want to run a function file for every 10 seconds
Next: ncrease the space between words in binary image
From: Gumah on 16 Apr 2010 21:57 ImageAnalyst,, Thanks for your code .. I used it .. and its works nicely..yes you are write about the sum vertically .. now I got a vector that contain all the empty column in the binary image .. This is a part of that vector [1 2 3 4 5 6 7 8 9 10 39 60 61 62 ... 114] now I need to pick up only the columns that not beside each other .. column 1,2,..10 are not adjacent to each other .. so that mean no words there .. but column 39 60 not adjacent to each other .. that means there are words (not empty columns) between them..I need to pick only those columns .. should use loop with if statement .. how should that be done? ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <bca85aec-5714-4a59-b37a-ac1b2139a1ea(a)v20g2000yqv.googlegroups.com>... > 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);
From: ImageAnalyst on 18 Apr 2010 15:31 Yes, you can loop over that set of indexes. But you use a special kind of loop - you don't have a starting and stopping index, you just use your set of values, like this: for k = myVector % Do stuff end The loop will go with k taking on ONLY the values that are in myVector, and no others.
First
|
Prev
|
Pages: 1 2 3 Prev: I want to run a function file for every 10 seconds Next: ncrease the space between words in binary image |