From: astro mmi on 12 Feb 2010 15:42 Hi everyone, Is there ant command in MATLAB to select a matrix of pixels from a whole image. For example, i want only the first 3*3 pixels, then the next 3*3 and so on. Is there a way I can do it? Thanx in advance.
From: ImageAnalyst on 12 Feb 2010 15:45 Just use regular indexing: m = magic(8) % Generate some sample data m3by3 = m(1:3,1:3) % Get the upper left 3x3 portion
From: astro mmi on 12 Feb 2010 15:59 Thank you so much. I have another query as to how I can find the center of this matix using a MATLAB command.Thanx ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <0beca35d-9a71-403b-8c94-fc90604e289a(a)o26g2000vbd.googlegroups.com>... > Just use regular indexing: > > m = magic(8) % Generate some sample data > m3by3 = m(1:3,1:3) % Get the upper left 3x3 portion
From: Walter Roberson on 12 Feb 2010 16:32 astro mmi wrote: > Hi everyone, > Is there ant command in MATLAB to select a matrix of pixels from a > whole image. For example, i want only the first 3*3 pixels, then the > next 3*3 and so on. Is there a way I can do it? Perhaps you want blkproc(). Note, though, that blkproc() can process the blocks in any order, so if you need to have them processed in a specific order or if you need to know the coordinates of the block you are processing, then you will need to program your own version.
From: Nathan on 12 Feb 2010 16:53 On Feb 12, 12:59 pm, "astro mmi" <pyarsa_ma...(a)yahoo.co.in> wrote: > Thank you so much. > I have another query as to how I can find the center of this matix using a MATLAB command.Thanx > Which matrix do you mean? The 3 by 3 matrix or the image matrix? If it's the 3 by 3 matrix, you can just do: centerofmatrix = m3by3(2,2); OR (as shown below) centerofmatrix = m3by3((size(m3by3,1)+1)/2,(size(m3by3,2)+1)/2) If it's the image matrix the center pixel can only be found if it's an odd x odd matrix as such: centerofimage = matrix((size(matrix,1)+1)/2,(size(matrix,2)+1)/2) If either of the dimensions are even, you have to decide what is considered to be the "center". I hope this helps. -Nathan
|
Pages: 1 Prev: Extract the portion from image Next: Abort problem on Mac (Matlab 2009b, 64 bit edition) |