From: "Twilighter " <>
Newsgroups: comp.soft-sys.matlab
Subject: 3x3 pixel neighborhood  window
Date: Sat, 9 Jul 2011 10:55:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <iv9c2d$e8j$>
Reply-To: "Twilighter " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1310208910 14611 (9 Jul 2011 10:55:10 GMT)
NNTP-Posting-Date: Sat, 9 Jul 2011 10:55:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2591832
Xref: comp.soft-sys.matlab:735650


i have a 64x64 image and

i need to make a window of [3 3] for every pixel in my image
so i will apply some certain algorithm on them later ....

 something like that 

I1 = unit8(floor(conflict(I, [3 3], 'slideing', mean)))

the resultant I1 is 64x64 matrix which corresponds to the mean of the center pixel by mean of its neighboring pixels

i need the [3 3] neighboring pixels of each  pixel in the image but without applying any function on it ...

so i tried this function

I2 = im2col(I, [3 3], 'sliding');

what i got is a 9x3844
i thought it will be 9x4096

as the total number of pixels are 4096 & each column corresponds to each pixel 3x3 window

so how can i get the 3x3 neighborhood window for each pixel in an image