Path: news.mathworks.com!not-for-mail
From: "Ashish Uthama" <first.last@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: damage measurement in a micrograph
Date: Thu, 29 Oct 2009 16:36:01 -0400
Organization: TMW
Lines: 55
Message-ID: <op.u2kwubcja5ziv5@uthamaa.dhcp.mathworks.com>
References: <hcadg1$3m1$1@fred.mathworks.com>
 <e6d94441-b5c2-4556-8a27-b41d75205d88@c3g2000yqd.googlegroups.com>
 <655ad327-a1b1-417c-b0f9-40d2643158ca@x5g2000prf.googlegroups.com>
 <hccs0j$c08$1@fred.mathworks.com>
NNTP-Posting-Host: uthamaa.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1256848561 6657 172.31.57.126 (29 Oct 2009 20:36:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 29 Oct 2009 20:36:01 +0000 (UTC)
User-Agent: Opera Mail/10.00 (Win32)
Xref: news.mathworks.com comp.soft-sys.matlab:581139


On Thu, 29 Oct 2009 15:56:03 -0400, Krishna Chaitanya  
<chaitanya.alur@gmail.com> wrote:

> ImageAnalyst <imageanalyst@mailinator.com> wrote in message  
> <655ad327-a1b1-417c-b0f9-40d2643158ca@x5g2000prf.googlegroups.com>...
>> Just do a web search for "free image hosting" and you'll find plenty
>> of options such as flickr.com, imageshack.us, etc.  Just upload it
>> somewhere so that everyone (not just me) can see it and offer you
>> advice.
>
>
> _____________________________
>
> Thanks for the information..
>
> here is the link for the micrograph...
>
> http://www.flickr.com/photos/30274557@N05/4056558292/
>
> the black portionis the damage and i have to measure the total damage in  
> that figure (total black portion but grain boundaries(thin lines in  
> between grains) are not to be counted)
>
> i'm able to locate the only damged part using the function,
>
> "rgb_bw_closed = imclose(rgb_r_bw, strel('disk',2));"
>
>  but unable to figure out the total area ........
>
> just have a look at it....

I had some fun with the image:

in=imread('in.jpg');

%intensity image
hsv=rgb2hsv(in);
v=hsv(:,:,3);
%imtool(v); %Used to objectively seletc the threshold

%threshold
v_bw=v>.6;
%imshow(v_bw);

%remove lines by closing
v_close=imclose(v_bw,strel('disk',2));
imshow(v_close);

%look up doc - this would give you the area of individual blobs. You could  
threshold the 'size' of the blobs if you wish..
stats=regionprops(~v_close,'Area')
CC = bwconncomp(~v_close);
L = labelmatrix(CC);
RGB = label2rgb(L);
imshow(RGB)