Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: DIVIDING AN IMAGE INTO SUB BLOCKS
Replies: 20   Last Post: Apr 3, 2014 1:29 AM

 Messages: [ Previous | Next ]
 sanyukta Posts: 34 Registered: 11/1/11
Re: DIVIDING AN IMAGE INTO SUB BLOCKS
Posted: Feb 17, 2012 11:45 PM

"Matt J" wrote in message <jh6c9n\$dtn\$1@newscl01ah.mathworks.com>...
> "sanyukta " <sanyuktachetia01@gmail.com> wrote in message <jh66hs\$rnc\$1@newscl01ah.mathworks.com>...
> > > On Feb 10, 12:44 pm, "sanyukta " <sanyuktacheti...@gmail.com> wrote:
> > > > Thanks..I have used mat2cell function and got a total of p=25 blocks.So each block has q=100x100 elements.Next,I want to concatenate all the elements of the block to give a vector to represent one block resulting in a matrix x=[x1,x2,....xp]of size qxp.How to do?
> > >
> > > ----------------------------------------------------------------------------------------------
> > > If I understand you correctly you want to take one particular block
> > > and concatenate all the elements of that block go give a 1D vector.
> > > To do that you just do:
> > >
> > > m = rand(500,500); % Sample data 500x500
> > > divisions = [100 100 100 100 100];
> > > % Chop up into 100x100 cells.
> > > mCell = mat2cell(m, divisions, divisions)
> > > % Pull out one particular cell - it will be a 100x100 array.
> > > thisBlock = mCell{2,4}; % Or whatever indexes you want.
> > > % Concatenate into vector 10000 elements long.
> > > columnVector = thisBlock(:);

> > Thanks..I used the following code:
> > clc;
> > clear all;
> > close all;
> > a1=rgb2gray(a);
> > a2=mat2cell(a1,[100 100 100 100 100],[100 100 100 100 100]);
> > disp(a2);
> >
> > I got the results of a2 as-
> >
> > Columns 1 through 4
> >
> > [100x100 uint8] [100x100 uint8] [100x100 uint8] [100x100 uint8]
> > [100x100 uint8] [100x100 uint8] [100x100 uint8] [100x100 uint8]
> > [100x100 uint8] [100x100 uint8] [100x100 uint8] [100x100 uint8]
> > [100x100 uint8] [100x100 uint8] [100x100 uint8] [100x100 uint8]
> > [100x100 uint8] [100x100 uint8] [100x100 uint8] [100x100 uint8]
> >
> > Column 5
> >
> > [100x100 uint8]
> > [100x100 uint8]
> > [100x100 uint8]
> > [100x100 uint8]
> > [100x100 uint8]
> > Means I got a total of 25 blocks.Next I want to concatenate all the elements of the 25 blocks to get a single vector.

> =================
>
> But what we can't understand is how the vector elements are supposed to be ordered. For example, one way you could have obtained a vector is simply to
> do a2=a1(:). No need to convert to a cell at all.

Well,i am going to do local processing on the image and feed the single vector in the self organizing map as input.As such I have converted the matrix into cell.Can you tell me how to create a 2-D self organizing map?I want to create a self organizing map of size 5x5.But i am not able to do it.Please help me if you have any idea.

Date Subject Author
2/10/12 sanyukta
2/10/12 Steven Lord
2/10/12 sanyukta
2/10/12 Matt J
2/10/12 ImageAnalyst
2/11/12 sanyukta
2/11/12 Matt J
2/17/12 sanyukta
2/18/12 Matt J
2/18/12 sanyukta
2/18/12 Matt J
2/20/12 sanyukta
2/21/12 Steven Lord
2/21/12 sanyukta
2/21/12 Matt J
2/22/12 sanyukta
2/22/12 Matt J
2/24/12 sanyukta
5/2/12 baran
2/10/12 Matt J