Thread Subject: damage measurement in a micrograph

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 28 Oct, 2009 21:36:01

Message: 1 of 26

Hi all..i'm new to matlab and i need some help...

I have to analyse a micrograph(is a picture showing grains, grain boundaries and defects) of steel and find the area damage in the micrograph...its an RGB image which looks like a greyscale image...i want to measure the lengh of total grain boudnaries and the area fraction of the damage...i worked out for grain boundary detection but aunable to find the area fraction of damage...

can anybody help me out..??

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 28 Oct, 2009 23:22:40

Message: 2 of 26

On Oct 28, 5:36 pm, "Krishna Chaitanya" <chaitanya.a...@gmail.com>
wrote:
> Hi all..i'm new to matlab and i need some help...
>
> I have to analyse a micrograph(is a picture showing grains, grain boundaries and defects) of steel and find the area damage in the micrograph...its an RGB image which looks like a greyscale image...i want to measure the lengh of total grain boudnaries and the area fraction of the damage...i worked out for grain boundary detection but aunable to find the area fraction of damage...
>
> can anybody help me out..??

-----------------------------------------------------------------------------------------------
But you didn't post an image for us to look at?
So all I can do is to refer you to this in hopes that it may help you
some:
http://www.mathworks.com/matlabcentral/fileexchange/25157

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 29 Oct, 2009 18:05:06

Message: 3 of 26

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <e6d94441-b5c2-4556-8a27-b41d75205d88@c3g2000yqd.googlegroups.com>...
> On Oct 28, 5:36?pm, "Krishna Chaitanya" <chaitanya.a...@gmail.com>
> wrote:
> > Hi all..i'm new to matlab and i need some help...
> >
> > I have to analyse a micrograph(is a picture showing grains, grain boundaries and defects) of steel and find the area damage in the micrograph...its an RGB image which looks like a greyscale image...i want to measure the lengh of total grain boudnaries and the area fraction of the damage...i worked out for grain boundary detection but aunable to find the area fraction of damage...
> >
> > can anybody help me out..??
>
> -----------------------------------------------------------------------------------------------
> But you didn't post an image for us to look at?
> So all I can do is to refer you to this in hopes that it may help you
> some:
> http://www.mathworks.com/matlabcentral/fileexchange/25157

-______________________-
thnx..its a bit helpful but..i exactly want to find the area of certain regions and the summed up value of such different regions in the image...
(here I dont find any option to upload the image...if you dont mind give me your email id so that i can send it to you)

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 29 Oct, 2009 18:12:29

Message: 4 of 26

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.

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 29 Oct, 2009 19:56:03

Message: 5 of 26

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....

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 29 Oct, 2009 20:07:17

Message: 6 of 26

Well then just threshold it and sum up all the pixels.

Subject: damage measurement in a micrograph

From: Ashish Uthama

Date: 29 Oct, 2009 20:36:01

Message: 7 of 26

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)

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 29 Oct, 2009 22:07:01

Message: 8 of 26

"Ashish Uthama" <first.last@mathworks.com> wrote in message <op.u2kwubcja5ziv5@uthamaa.dhcp.mathworks.com>...
> 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)

_____________________________________
thank you....i'm using R2008...seems there is some problem with the function 'bwconncomp'....its saying that 'no function exists like that'....

Instead of that I selected the binary image and counted the total no. of 0(zeros) in that and we know the size of the image (m*n) i.e. total number of elements (pixels) in that image...so we can caliculate the % of damage....hope this will do......

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 29 Oct, 2009 23:06:28

Message: 9 of 26

On Oct 29, 6:07 pm, "Krishna Chaitanya" <chaitanya.a...@gmail.com>
wrote:
> thank you....i'm using R2008...seems there is some problem with the function 'bwconncomp'....its saying that 'no function exists like that'....
>
--------------------------------------------------------
In that version you use "bwlabel()"

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 3 Nov, 2009 20:18:04

Message: 10 of 26

Can some one help me out in finding the centroid of each grain in the figure below..

http://www.flickr.com/photos/30274557@N05/4056558292/..

Subject: damage measurement in a micrograph

From: Ashish Uthama

Date: 3 Nov, 2009 21:36:36

Message: 11 of 26

On Tue, 03 Nov 2009 15:18:04 -0500, Krishna Chaitanya
<chaitanya.alur@gmail.com> wrote:

> Can some one help me out in finding the centroid of each grain in the
> figure below..
>
> http://www.flickr.com/photos/30274557@N05/4056558292/..

I hope you studied the previous example I posted. Going through the help
for the functions used might give you some better ideas to implement on
your own.


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);

[v_labeled numLabels]= bwlabel(~v_close,4);

imtool(v_labeled); %place your cursor on the largest blob, note the label
value (the intensity value)


%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_labeled,'Area','Centroid')

%plot([stats.Area]); %You could use the area criterion to filter out the
smaller potential false positives.

stats(58) %The label value of the largest blob

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 4 Nov, 2009 03:12:16

Message: 12 of 26

Ashish's code will find the defects - the large dark areas. The code
I'm giving you below will find the grains. Run it and see. What you
have to do to find the grains not including the defects is to use
Ashish's defect image and use it to mask (multiply) my labeled image.
That way you'll get the grains not including the defects. The key to
finding the grain boundaries is to use the bottom hat filter. Then
skeletonize them down to single dividing lines. Then just label, mask
with Ashish's defect map, then call regionprops on the grains. You
can call regionprops on the defect image if you want info on the
defects too. I don't have anymore time to mask out the grains with
the defects (I already spent an hour on this algorithm for you) but I
think you can handle it from here.

% Demo to find grains in a metallurgical micrograph.
% by ImageAnalyst
% function test
clc;
close all;
clear all;
workspace; % Show the Workspace panel.
originalImage = imread('grains.jpg');
tic; % Start timer.
originalImage = rgb2gray(originalImage);
figure;
imshow(originalImage);
title('Original Image');

% Do a bottom hat filter.
se = strel('disk', 5);
topHatImage = imbothat(originalImage,se);
figure;
imshow(topHatImage, []);
title('Bottom Hat Image');
% imwrite(topHatImage, 'bottom hat image.bmp');

% Threshold at 20
figure;
grainsImage = topHatImage > 20;
imshow(grainsImage, []);
% Remove small debris.
grainsImage = bwareaopen(grainsImage, 50);
imshow(grainsImage, []);
% Close gaps
grainsImage = imclose(grainsImage, ones(3));
imshow(grainsImage, []);
% Skeletonize to find boundary lines.
grainsImage = bwmorph(grainsImage, 'skel', inf);
grainsImage = bwmorph(grainsImage, 'spur', inf);
imshow(grainsImage, []);
% Remove small lines.
grainsImage = ~bwareaopen(grainsImage, 650);
imshow(grainsImage, []);
% Remove partial grains, where we don't have the complete grain.
grainsImage = imclearborder(grainsImage, 4);
% Show the final image.
imshow(grainsImage, []);
title('Thresholded Image');

% Label it.
labeledImage = bwlabel(grainsImage, 4);
coloredLabeledImage = label2rgb(labeledImage, 'lines');
figure;
imshow(coloredLabeledImage, []);
title('Labeled Image');
grainMeasurements = regionprops(labeledImage, 'all');
toc; % Stop timer.

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 11 Nov, 2009 18:50:07

Message: 13 of 26

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <0396a454-3b1a-46e4-bffb-e769ea7043d1@s15g2000yqs.googlegroups.com>...
> Ashish's code will find the defects - the large dark areas. The code
> I'm giving you below will find the grains. Run it and see. What you
> have to do to find the grains not including the defects is to use
> Ashish's defect image and use it to mask (multiply) my labeled image.
> That way you'll get the grains not including the defects. The key to
> finding the grain boundaries is to use the bottom hat filter. Then
> skeletonize them down to single dividing lines. Then just label, mask
> with Ashish's defect map, then call regionprops on the grains. You
> can call regionprops on the defect image if you want info on the
> defects too. I don't have anymore time to mask out the grains with
> the defects (I already spent an hour on this algorithm for you) but I
> think you can handle it from here.
>
> % Demo to find grains in a metallurgical micrograph.
> % by ImageAnalyst
> % function test
> clc;
> close all;
> clear all;
> workspace; % Show the Workspace panel.
> originalImage = imread('grains.jpg');
> tic; % Start timer.
> originalImage = rgb2gray(originalImage);
> figure;
> imshow(originalImage);
> title('Original Image');
>
> % Do a bottom hat filter.
> se = strel('disk', 5);
> topHatImage = imbothat(originalImage,se);
> figure;
> imshow(topHatImage, []);
> title('Bottom Hat Image');
> % imwrite(topHatImage, 'bottom hat image.bmp');
>
> % Threshold at 20
> figure;
> grainsImage = topHatImage > 20;
> imshow(grainsImage, []);
> % Remove small debris.
> grainsImage = bwareaopen(grainsImage, 50);
> imshow(grainsImage, []);
> % Close gaps
> grainsImage = imclose(grainsImage, ones(3));
> imshow(grainsImage, []);
> % Skeletonize to find boundary lines.
> grainsImage = bwmorph(grainsImage, 'skel', inf);
> grainsImage = bwmorph(grainsImage, 'spur', inf);
> imshow(grainsImage, []);
> % Remove small lines.
> grainsImage = ~bwareaopen(grainsImage, 650);
> imshow(grainsImage, []);
> % Remove partial grains, where we don't have the complete grain.
> grainsImage = imclearborder(grainsImage, 4);
> % Show the final image.
> imshow(grainsImage, []);
> title('Thresholded Image');
>
> % Label it.
> labeledImage = bwlabel(grainsImage, 4);
> coloredLabeledImage = label2rgb(labeledImage, 'lines');
> figure;
> imshow(coloredLabeledImage, []);
> title('Labeled Image');
> grainMeasurements = regionprops(labeledImage, 'all');
> toc; % Stop timer.
____________

Nice and thanks..

but what i asked is to find the centroid of each grain in the image....(a grain is the one which is surrounded by a closed black boundary...i.e the black lines are grain boundaries and the gray portion is grain)...i tried to sort out...but i'm unable to...help me in finding the centroid of each grain....

thank you..

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 11 Nov, 2009 19:00:19

Message: 14 of 26

"Krishna Chaitanya" <chaitanya.alur@gmail.com> wrote in message <hdf10v$1t1$1@fred.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <0396a454-3b1a-46e4-bffb-e769ea7043d1@s15g2000yqs.googlegroups.com>...
> > Ashish's code will find the defects - the large dark areas. The code
> > I'm giving you below will find the grains. Run it and see. What you
> > have to do to find the grains not including the defects is to use
> > Ashish's defect image and use it to mask (multiply) my labeled image.
> > That way you'll get the grains not including the defects. The key to
> > finding the grain boundaries is to use the bottom hat filter. Then
> > skeletonize them down to single dividing lines. Then just label, mask
> > with Ashish's defect map, then call regionprops on the grains. You
> > can call regionprops on the defect image if you want info on the
> > defects too. I don't have anymore time to mask out the grains with
> > the defects (I already spent an hour on this algorithm for you) but I
> > think you can handle it from here.
> >
> > % Demo to find grains in a metallurgical micrograph.
> > % by ImageAnalyst
> > % function test
> > clc;
> > close all;
> > clear all;
> > workspace; % Show the Workspace panel.
> > originalImage = imread('grains.jpg');
> > tic; % Start timer.
> > originalImage = rgb2gray(originalImage);
> > figure;
> > imshow(originalImage);
> > title('Original Image');
> >
> > % Do a bottom hat filter.
> > se = strel('disk', 5);
> > topHatImage = imbothat(originalImage,se);
> > figure;
> > imshow(topHatImage, []);
> > title('Bottom Hat Image');
> > % imwrite(topHatImage, 'bottom hat image.bmp');
> >
> > % Threshold at 20
> > figure;
> > grainsImage = topHatImage > 20;
> > imshow(grainsImage, []);
> > % Remove small debris.
> > grainsImage = bwareaopen(grainsImage, 50);
> > imshow(grainsImage, []);
> > % Close gaps
> > grainsImage = imclose(grainsImage, ones(3));
> > imshow(grainsImage, []);
> > % Skeletonize to find boundary lines.
> > grainsImage = bwmorph(grainsImage, 'skel', inf);
> > grainsImage = bwmorph(grainsImage, 'spur', inf);
> > imshow(grainsImage, []);
> > % Remove small lines.
> > grainsImage = ~bwareaopen(grainsImage, 650);
> > imshow(grainsImage, []);
> > % Remove partial grains, where we don't have the complete grain.
> > grainsImage = imclearborder(grainsImage, 4);
> > % Show the final image.
> > imshow(grainsImage, []);
> > title('Thresholded Image');
> >
> > % Label it.
> > labeledImage = bwlabel(grainsImage, 4);
> > coloredLabeledImage = label2rgb(labeledImage, 'lines');
> > figure;
> > imshow(coloredLabeledImage, []);
> > title('Labeled Image');
> > grainMeasurements = regionprops(labeledImage, 'all');
> > toc; % Stop timer.
> ____________
>
> Nice and thanks..
>
> but what i asked is to find the centroid of each grain in the image....(a grain is the one which is surrounded by a closed black boundary...i.e the black lines are grain boundaries and the gray portion is grain)...i tried to sort out...but i'm unable to...help me in finding the centroid of each grain....

> http://www.flickr.com/photos/30274557@N05/4056558292/

> thank you..

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 11 Nov, 2009 19:06:00

Message: 15 of 26

On Nov 11, 1:50 pm, "Krishna Chaitanya" <chaitanya.a...@gmail.com>
wrote:
> Nice and thanks..
>
> but what i asked is to find the centroid of each grain in the image....(a grain is the one which is surrounded by a closed black boundary...i.e the black lines are grain boundaries and the gray portion is grain)...i tried to sort out...but i'm unable to...help me in finding the centroid of each grain....
>
> thank you..-

-----------------------------------------------------------------------------------------------------------------
Why not? The centroids are right there in the grainMeasurements
structure. Just look at it in the Variable Editor.
You can pull them out by doing this if you want
centroidsOfAllBlobs = [grainMeasurements.Centroid];

Or perhaps you should take another look at my demo
http://www.mathworks.com/matlabcentral/fileexchange/25157
where I pull them out one by one.

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 12 Nov, 2009 19:46:19

Message: 16 of 26

> Why not? The centroids are right there in the grainMeasurements
> structure. Just look at it in the Variable Editor.
> You can pull them out by doing this if you want
> centroidsOfAllBlobs = [grainMeasurements.Centroid];
>
> Or perhaps you should take another look at my demo
> http://www.mathworks.com/matlabcentral/fileexchange/25157
> where I pull them out one by one.

________________--
Nice and thanks...I found the centroids of the grains and plotted voronoi diagram..I found that its a over approximation...i plotted the voronoi diagram using the following..

%%%
counter = 0;
for i= 1:2:length(centroidsOfAllGrains)
    counter = counter + 1;
    X_centroid(counter) = centroidsOfAllGrains(i);
    Y_centroid(counter) = centroidsOfAllGrains(i+1);
end

% Forming a voronoi diagram from the above points

voronoi(X_centroid,Y_centroid)

%%%

if i plot there is a huge difference between the original graph and the voronoi digram..

can you give any idea....how to proceed??

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 12 Nov, 2009 23:37:19

Message: 17 of 26

Well what the heck are you even using the Voronoi diagram for???

You have the actual boundaries and grain shapes. Why throw those away
and use a very coarse approximation? What's the rationale for that???

Subject: damage measurement in a micrograph

From: Krishna Chaitanya

Date: 13 Nov, 2009 13:08:05

Message: 18 of 26

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <c21d78f3-2eb9-4e18-9012-94ceb6fca9f7@g23g2000yqh.googlegroups.com>...
> Well what the heck are you even using the Voronoi diagram for???
>
> You have the actual boundaries and grain shapes. Why throw those away
> and use a very coarse approximation? What's the rationale for that???
___________

Actually i want to find the number of facets, each damaged portion is associated with (i.e. if a damage portion is connected of three grains, we can say that length of that damaged portion is 3 facets). Like this i have to find for all damaged regions.

What i thought for this is, draw a voronoi diagram with the centroids as inputs(with this we will get a coarse approximation), after that i can fin the number of edges associated with damage by some other means.

Briefly, this is what i have to do...

Can you give any better idea to do that...of give some guide lines to proceed further...

Thank you...

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 13 Nov, 2009 14:47:33

Message: 19 of 26

If it were me, I'd look into the "branchpoints" option of bwmorph.

Subject: damage measurement in a micrograph

From: Krishna C

Date: 14 Nov, 2009 12:25:02

Message: 20 of 26

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3f186ad0-7fbb-4b57-8fbe-b70a88a4a79c@a21g2000yqc.googlegroups.com>...
> If it were me, I'd look into the "branchpoints" option of bwmorph.

____
Dont mind..i didnt found the option...
i'm using 7.6.0 (R2008a)..

Subject: damage measurement in a micrograph

From: Krishna C

Date: 14 Nov, 2009 16:42:00

Message: 21 of 26

"Krishna C" <chaitanya.alur@gmail.com> wrote in message <hdm7iu$9ll$1@fred.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3f186ad0-7fbb-4b57-8fbe-b70a88a4a79c@a21g2000yqc.googlegroups.com>...
> > If it were me, I'd look into the "branchpoints" option of bwmorph.
>
> ____
> Dont mind..i didnt found the option...
> i'm using 7.6.0 (R2008a)..

Image analyst sir...kindly respond....

Subject: damage measurement in a micrograph

From: dpb

Date: 14 Nov, 2009 17:09:23

Message: 22 of 26

Krishna C wrote:
> "Krishna C" <chaitanya.alur@gmail.com> wrote in message <hdm7iu$9ll$1@fred.mathworks.com>...
>> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3f186ad0-7fbb-4b57-8fbe-b70a88a4a79c@a21g2000yqc.googlegroups.com>...
>>> If it were me, I'd look into the "branchpoints" option of bwmorph.
>> ____
>> Dont mind..i didnt found the option...
>> i'm using 7.6.0 (R2008a)..
>
> Image analyst sir...kindly respond....

Chill...it's a weekend--even dedicated c.s-s.m _volunteers_ take _some_
time off...

--

Subject: damage measurement in a micrograph

From: ImageAnalyst

Date: 16 Nov, 2009 02:08:14

Message: 23 of 26

On Nov 14, 11:42 am, "Krishna C" <chaitanya.a...@gmail.com> wrote:
> "Krishna C" <chaitanya.a...@gmail.com> wrote in message <hdm7iu$9l...@fred.mathworks.com>...
? > Dont mind..i didnt found the option...
> > i'm using 7.6.0 (R2008a)..
>
> Image analyst sir...kindly respond....
---------------------------------------------------------------------------------
What do you really want to know? Looking at your image, I contend
that trying to figure out how many facets each black, damaged region
is associated with is useless. I think that the only thing that makes
sense is the number per unit area, the area fraction, and the size
distribution. Again, what do you want to know? I mean KNOW, not
measure. You think you need to measure facets. But if you do, what
will that tell you, other than the number of facets? For example, you
want to predict the likelihood of failure of this material (when it's
doing whatever it is that it's supposed to do), so you want to know
the estimate of percent failure for this material. To get a that, you
have an image, and with that image you could measure dozens or
hundreds of things. So maybe you do measure hundreds of things and
then test the material and build up a model that gives likelihood of
failure or success as a function of hundreds of different
measurements. You could then do PCA or something similar to figure
out which of those hundreds of things you measured actually correlated
with success or failure. So I don't know why you're so convinced that
it's the facets, unless prior papers and experimentation have proven
that facets is in fact the only thing that matters.

As sort of a side note on the route you decided to pursue . . . you
decided to construct a Voronoi diagram by putting a point at the
centroid of each region. Look again at the Voronoi diagrams in the
help. Do you see that the Voronoi points are at the center of mass of
each Voronoi region? The answer is no. The little red "+" symbols
are NOT at the cendtroid of the blue polygonal regions. But that is
what you're assuming and doing. Now, if you made a second Voronoi
diagram using the actual centroids of the regions from the first
Voronoi, do you think the blue dividing lines would fall in exactly
the same place as on the first Voronoi? Do you think you'd have the
same number of facets in the same locations? No, you won't, to either
question. Here's proof:

% Demo to show the voronoi will not create regions
% with points at the center of the regions, and if we
% do create a voronoi from centroids of regions,
% it will not be the same.
% by ImageAnalyst
% function test
clc;
close all;
clear all;
workspace; % Show the Workspace panel.
rand('state',5);
x = rand(1,10); y = rand(1,10);
subplot(2, 2, 1);
[vx, vy] = voronoi(x,y);
plot(x,y,'r+',vx,vy,'b-');
set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.
title('First Voronoi: + not at centroids');
axis equal;
xlim([min(x) max(x)]);
ylim([min(y) max(y)]);
uiwait(msgbox('Note the red + are not at the centroids'));
% Get the image of the regions.
dividingLines = getFrame(gca);
img = dividingLines.cdata;
regions = img(:,:,1) > 0;
subplot(2, 2, 2);
imshow(regions, []);
% Label it and measure the location of the centroids.
[labeledImage, numberOfRegions] = bwlabel(regions, 4);
regionsMeasurements = regionprops(labeledImage, 'Centroid');
for blob = 1 : numberOfRegions
centersX(blob) = regionsMeasurements(blob).Centroid(1);
centersY(blob) = regionsMeasurements(blob).Centroid(2);
end
hold on;
plot(centersX, centersY, '+g');
title('First Voronoi: with centroids marked with green +');
uiwait(msgbox('Note the green + are now at the actual centroids'));
% Get another voronoi using the centroids of the first one.
[vx2, vy2] = voronoi(centersX, centersY);
subplot(2, 2, 3);
plot(centersX,centersY,'g+',vx2, vy2,'b-');
axis equal;
xlim([min(centersX) max(centersX)]);
ylim([min(centersY) max(centersY)]);
title('Second Voronoi created from centroids of first Voronoi');
uiwait(msgbox('Note the blue Voronoi lines are NOT the same as on the
first Voronoi'));

The above proves that the voronoi that you calculate from the
centroids of the regions will not overlap with the grain boundaries
like you were hoping for. Nor will the number of facets be the same.
Sorry.

Now look at your image. Look at the dark defects. Never mind the
computer, can YOU tell me how many facets each defect has? I thought
not. But that is what you think you need to measure for some reason.

Subject: damage measurement in a micrograph

From: Krishna C

Date: 9 Feb, 2010 17:52:05

Message: 24 of 26

Sir
 what you said is exactly right..But the model development of damage analysis is not my part..i'm only concerned with the extracting data from micrographs..thats my work...

So extracting the number of facets is the difficult thing and i'm trying to do that...i have to develop a code to extract such details..

Can you give any idea for counting the number of facets of damaged portion??..that will be very helpful for me..

I'm thinking that after labeling the damaged portions, using 'convexhull' or by some othr means drawing a polygon around the damage portion and later cheking out the neighboring pixels around the boundary and so on..and when a pixel encounters a neighboring pixel as part of the grain boundary we can increae the count..
I'm not sure weather my idea works or not, i have to try it.

http://www.flickr.com/photos/30274557@N05/4056558292/

thank you.

Subject: damage measurement in a micrograph

From: Krishna C

Date: 9 Feb, 2010 17:53:03

Message: 25 of 26

Sir
 what you said is exactly right..But the model development of damage analysis is not my part..i'm only concerned with the extracting data from micrographs..thats my work...

So extracting the number of facets is the difficult thing and i'm trying to do that...i have to develop a code to extract such details..

Can you give any idea for counting the number of facets of damaged portion??..that will be very helpful for me..

I'm thinking that after labeling the damaged portions, using 'convexhull' or by some othr means drawing a polygon around the damage portion and later cheking out the neighboring pixels around the boundary and so on..and when a pixel encounters a neighboring pixel as part of the grain boundary we can increae the count..
I'm not sure weather my idea works or not, i have to try it.

http://www.flickr.com/photos/30274557@N05/4056558292/

thank you.

Subject: damage measurement in a micrograph

From: Krishna C

Date: 9 Feb, 2010 17:54:02

Message: 26 of 26

Sir
 what you said is exactly right..But the model development of damage analysis is not my part..i'm only concerned with the extracting data from micrographs..thats my work...

So extracting the number of facets is the difficult thing and i'm trying to do that...i have to develop a code to extract such details..

Can you give any idea for counting the number of facets of damaged portion??..that will be very helpful for me..

I'm thinking that after labeling the damaged portions, using 'convexhull' or by some othr means drawing a polygon around the damage portion and later cheking out the neighboring pixels around the boundary and so on..and when a pixel encounters a neighboring pixel as part of the grain boundary we can increae the count..
I'm not sure weather my idea works or not, i have to try it.

http://www.flickr.com/photos/30274557@N05/4056558292/

thank you.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
centroid Chaitu 11 Nov, 2009 13:54:12
image Chaitu 11 Nov, 2009 13:54:12
rssFeed for this Thread

Contact us at files@mathworks.com