Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: combine image parts
Date: Sun, 26 Jul 2009 19:38:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 40
Message-ID: <h4ibap$3f0$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> <h4hmf9$6v3$1@fred.mathworks.com> <h4hr5a$7vl$1@fred.mathworks.com> <h4i1up$13i$1@fred.mathworks.com> <h4i2a1$r36$1@fred.mathworks.com> <h4i65q$hpv$1@fred.mathworks.com> <h4i7q9$5hf$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248637081 3552 172.30.248.37 (26 Jul 2009 19:38:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 26 Jul 2009 19:38:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1916313
Xref: news.mathworks.com comp.soft-sys.matlab:558447


"us " <us@neurol.unizh.ch> wrote in message <h4i7q9$5hf$1@fred.mathworks.com>...
> "Brian J."
> > The last thing about this is binarization. I have tried to solve it by myself but the error is very different so again I need you. When I write the following code:
> > 
> >      binaryImage=im2bw(simg, graythresh(simg)); figure(2); imshow(binaryImage);
> > 
> > then I am getting the following error:
> > 
> > ??? Error
> > using ==>
> > imageDisplayValidateParams>validateCData
> > at 114 Unsupported dimension
> 
> well, yes - and - of course...
> - you add stuff, which you did not mention in your OPs...
> - this starts to make things a bit tedious...
> 
> now, look at the code snippet, again, and look at what i said
> 
> % pre-allocation section
>      simg=zeros(m+1,m+1,1,ni*ni);     % <- a 4-D matrix for MONTAGE(!)...
> % in the loop section
>      simg(:,:,1,k)=[img(xv,yv),del.';del,-100];     % <- note the SINGLETON(!)...
> % this is necesssary to get MONTAGE to work
>      help montage;
> 
> if you want to add some sort of ...binarization..., you should do it in the loop using your original subimage IMG(XV,YV) data...
> 
> us

Dear "us", you are right. I should say the main goal at the begining. The goal is to do connected component labeling for each segmented region of the original image and to use region properties.  For this purpose, the codes that I have tried to add (but could not do) to above codes are;

  labeledImage = bwlabel(binaryImage); % Label each region to do do calc on it
  regionMeasurements = regionprops(labeledImage, 'all');

for k = 1 : numberOfregions % Loop through all regions.
thisregionPixels = regionMeasurements(k).PixelIdxList; % Get list of pixels in current region.
meanGL = mean(originalImage(thisregionPixels)); % Find mean intensity in original image
regionCentroid = regionMeasurements(k).Centroid; 
end