Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: divide 1280-by-960 image into 9-by-9
Date: Sun, 29 May 2011 12:09:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <irtd11$267$1@newscl01ah.mathworks.com>
References: <irm4h1$jke$1@newscl01ah.mathworks.com> <irm660$ok7$1@newscl01ah.mathworks.com> <irm7rs$lq$1@newscl01ah.mathworks.com> <irmatm$gfc$1@newscl01ah.mathworks.com> <iroa2l$pr5$1@newscl01ah.mathworks.com> <iroh3k$io4$1@newscl01ah.mathworks.com> <irp5js$htg$1@newscl01ah.mathworks.com> <irpask$131$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1306670945 2247 172.30.248.47 (29 May 2011 12:09:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 29 May 2011 12:09:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2891622
Xref: news.mathworks.com comp.soft-sys.matlab:729190

"Jeff " <jea@gene.dot.com>
> > > > > grayimg = rgb2gray(imagein);
> > > > > 
> > > > > padimg = padarray(grayimg, [3 4], 0, 'post'); %modify these values to make your image dimensions divisible by 9
> > > > > 
> > > > > height = size(padimg,1); %height of full image
> > > > > width = size(padimg,2); %width of full image
> > > > > 
> > > > > n_width = 9;
> > > > > m_height = 9;
> > > > > 
> > > > > for x = 1:m_height:height
> > > > >     for y=1:n_width:width
> > > > >         image = bigmont(y:y+m_height-1, x:x+n_width-1);
> > > > >         imwrite(image,strcat(num2str(x),'^',num2str(y),'.jpg'),'jpg', 'Quality',80);
> > > > >     end
> > > > > 
> > > > > end

> The "Index exceeds matrix dimensions" is probably because you need to change the "3" and "4" in:
> padimg = padarray(grayimg, [3 4], 0, 'post');
> to give you an image with dimensions evenly divisible by 9.  
> 
> For example, you could make your image 963x1267 by using:
> padimg = padarray(grayimg, [3 7], 0, 'post');
> 
> As far as "reducing the image"...the variable IMAGE is a 9x9 fragment of PADIMAGE that moves across the image, in a typewriter fashion, through PADIMAGE as the X and Y loops increment.  Instead of calling IMWRITE, you could assign it to individual cells in a cell array: (http://www.mathworks.com/help/techdoc/matlab_prog/br04bw6-98.html#br1zng6-1).  Does this make sense?

Jeff,
i had done the same way as you are refering to i.e. i had changed 4 with 7 in:
padimg line...and got the error i told you (index exceed matrix dimension)...
and thank you..now i got about the variable image point..

do i need to reduce my image size? if yes then how?