Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: combine image parts
Date: Sun, 26 Jul 2009 13:42:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 66
Message-ID: <h4hmf9$6v3$1@fred.mathworks.com>
References: <h4bv2g$ac0$1@fred.mathworks.com> <701f52c0-8ab6-4b0a-ac88-7dec944aa8ce@n11g2000yqb.googlegroups.com> <h4fgav$k3q$1@fred.mathworks.com> <h4fi8p$msr$1@fred.mathworks.com> <h4fjv5$d7q$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248615721 7139 172.30.248.35 (26 Jul 2009 13:42:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 26 Jul 2009 13:42:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1916313
Xref: news.mathworks.com comp.soft-sys.matlab:558401


"Brian J." <brian0945@gmail.com> wrote in message <h4fjv5$d7q$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <h4fi8p$msr$1@fred.mathworks.com>...
> > "Brian J." <brian0945@gmail.com> wrote in message <h4fgav$k3q$1@fred.mathworks.com>...
> > > ImageAnalyst <imageanalyst@mailinator.com> wrote in message <701f52c0-8ab6-4b0a-ac88-7dec944aa8ce@n11g2000yqb.googlegroups.com>...
> > > > On Jul 24, 5:32?am, "us2 " <u...@yahoo.com> wrote:
> > > > > I have NxM sized image and divide it into let's say 4 different parts. I want to see these parts in a figure with a blank between them.
> > > > >
> > > > > I mean that the new image figure must include all the parts but it must be seen as divided. When I convert the new image into binary, I want to see 4 different partitions separately
> > > > >
> > > > > how to do this?
> > > > 
> > > > ------------------------------------------------------------
> > > > One way:
> > > > 1. crop your image into 4 separate images.
> > > > 2. indicate the axes with subplot(2,2,1).  last arg would be 1, 2, 3,
> > > > or 4.
> > > > 3. display image with image, imshow, or imagesc.
> > > > 4. repeat steps 2 and 3 until all four parts have been displayed.
> > > 
> > > My problem is similar to this question. I have divided my original image into 4 parts and now, I have to combine them so that when we convert the combined image to binary image then we must see the 4 white region and black background in the binary image. 
> > > how to do this?
> > 
> > one of the solutions
> > 
> >      img=1+ceil(100*rand(8));     % <- the image
> >      i1=img(1:4,1:4);     % <- the subimages...
> >      i2=img(1:4,5:8);
> >      i3=img(5:8,1:4);
> >      i4=img(5:8,5:8);
> >      del=zeros(4,1);     % <- delimiter between subimages...
> >      ic=[i1,del,i2;del.',0,del.';i3,del,i4];     % <- img with delimiters...
> >      imagesc(ic);
> >      axis image;
> >      colormap([[0,0,0];jet(100)]);
> >      colorbar;
> > 
> > us
> 
> many many thanks ..
> best wishes..

I have 256x256 sized image and want to divide this image into 64x64 sized blocks (then there will be 16 equal sized block) and combine them. So, to be able to generalize the above codes for this purpose, I have written that;

X1=1; k=1; 
for j=1:4
    Y2=0;
    for i=1:4
        X2=64*j;
        Y1=Y2+1;
        Y2=64*i;
        r(k)=p(X1:X2, Y1:Y2); k=k+1;
    end
    X1=X2+1;
end

 del=zeros(64,1); % <- delimiter between subimages...
 
ic=[r(1),del,r(2),del,r(3),del,r(4); del.',0,del.',0,del.',0,del.';r(5),del,r(6),del,r(7),del,r(8); del.',0,del.',0,del.',0,del.'; r(9),del,r(10),del,r(11),del,r(12); del.',0,del.',0,del.',0,del.';r(13),del,r(14),del,r(15),del,r(16)];     

But , I am getting this error:

???  In an assignment  A(I) =B, the number of elements in B and  I must be the same. 
I think, there is a problem with this code:
                                     r(k)=p(X1:X2, Y1:Y2);  k=k+1;

What must I do?