From: saurabh pandey on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <db46ad54-5b34-458d-aa55-7635cc45b207(a)y11g2000yqm.googlegroups.com>...
> bwarea calculates area only on the entire image, so it's "accurate" if
> you have only one objects. Otherwise, if you have multiple objects,
> you should use the area measurement given by regionprops. And bwarea
> does NOT calculate perimeter as you said. Also note that bwarea uses
> a special definition of area - it's not simply counting pixels.
>
> What you're calling "percent of segmentation" is most often called
> "area fraction" and it is simply the segmented area(s) divided by the
> total image area (like you said). The total image area is the same
> for the gray image and its binary representation - basically it's the
> total number of pixels in the image.
>
> I'm not sure how to answer "can you please tell me what is meant by
> area in gray and binary image?" Area is the number of pixels, or real
> world units if you have a spatial calibration. Once you know what
> pixels to include, be it a segmented portion of your image or the
> entire image, the area is simply the number of pixels and it makes no
> difference whatsoever whether those pixels are in a gray image or a
> binary image - you're just counting pixels and you don' care whether
> they are 0 & 1 or range from 0-255.


please tell me how the regionprop command can be used to calculate the area of image '2.jpg' uploaded to picasaweb.i am confused too much.
please reply
http://picasaweb.google.com/sathiya.saurabh/Saurabh_work_matlab#5473284912166176226
please send me the code..
thanks waitin for ur reply
From: ImageAnalyst on
The area of *what*? Those are very complicated images with lots of
weird looking, ill defined things in them. It's not really clear
what is to be measured, and it's not clear what you're even asking.
If we go by exactly what you ask -- "calculate the area of image" --
then we'd just say that the area is the number of pixels in your image
(converted to real world units such as mm^2 if you wish). I'd have a
tough time segmenting anything out of those images so if you just need
the area of some subset of objects in there, I'd use your expert human
knowledge and manually outline them. Heck, even with manually drawing
them I think there would be lots of judgement calls as to where to
draw the lines. There is nothing distinct enough in the images, and
the images aren't even similar enough, to waste time trying to develop
an automatic algorithm for them (unless that's the whole point of your
dissertation work).

I don't have any code to send you, but you said that you already has
code that segmented something out of those images. I'd be interested
in seeing that code because I have no idea what it could possibly find.
From: saurabh pandey on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <62e96cdf-2c99-4939-8e14-fd943c8f8e14(a)c33g2000yqm.googlegroups.com>...
> The area of *what*? Those are very complicated images with lots of
> weird looking, ill defined things in them. It's not really clear
> what is to be measured, and it's not clear what you're even asking.
> If we go by exactly what you ask -- "calculate the area of image" --
> then we'd just say that the area is the number of pixels in your image
> (converted to real world units such as mm^2 if you wish). I'd have a
> tough time segmenting anything out of those images so if you just need
> the area of some subset of objects in there, I'd use your expert human
> knowledge and manually outline them. Heck, even with manually drawing
> them I think there would be lots of judgement calls as to where to
> draw the lines. There is nothing distinct enough in the images, and
> the images aren't even similar enough, to waste time trying to develop
> an automatic algorithm for them (unless that's the whole point of your
> dissertation work).
>
> I don't have any code to send you, but you said that you already has
> code that segmented something out of those images. I'd be interested
> in seeing that code because I have no idea what it could possibly find.



thank you very much for your support.
as you told i calculate the area of image using regionprops by converting it to binary by im2bw.now i find edges by using canny and sobel operator which are also binary images.can i calculate area for that image? is this perfect for analysis purposes?
From: Christopher on
"saurabh pandey" <sathiya_saurabh(a)yahoo.co.in> wrote in message <i0c2gd$q9o$1(a)fred.mathworks.com>...
> ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <62e96cdf-2c99-4939-8e14-fd943c8f8e14(a)c33g2000yqm.googlegroups.com>...
> > The area of *what*? Those are very complicated images with lots of
> > weird looking, ill defined things in them. It's not really clear
> > what is to be measured, and it's not clear what you're even asking.
> > If we go by exactly what you ask -- "calculate the area of image" --
> > then we'd just say that the area is the number of pixels in your image
> > (converted to real world units such as mm^2 if you wish). I'd have a
> > tough time segmenting anything out of those images so if you just need
> > the area of some subset of objects in there, I'd use your expert human
> > knowledge and manually outline them. Heck, even with manually drawing
> > them I think there would be lots of judgement calls as to where to
> > draw the lines. There is nothing distinct enough in the images, and
> > the images aren't even similar enough, to waste time trying to develop
> > an automatic algorithm for them (unless that's the whole point of your
> > dissertation work).
> >
> > I don't have any code to send you, but you said that you already has
> > code that segmented something out of those images. I'd be interested
> > in seeing that code because I have no idea what it could possibly find.
>
>
>
> thank you very much for your support.
> as you told i calculate the area of image using regionprops by converting it to binary by im2bw.now i find edges by using canny and sobel operator which are also binary images.can i calculate area for that image? is this perfect for analysis purposes?

Your description is confusing but let's see if this is what you want.. From what I can gather you have an initial greyscale image. You use an edge detection algorithm and then morphological operations to estimate a segmented image. This segmented image will now be a black and white image, with the white pixels representing the "image" and the black pixels representing the "background"...

You now wish to determine the ratio of the segmented image to the original image as a measure of the fraction of image segmented from the original..

I would assume something like this:
*********************************************************************
% read in the original image
greyIm = imread('testIm.jpg');

% perform edge detection (example threshold)
edgeDetect = edge(greyIm,'Canny',0.4);

% perform morphology
diskEnt = strel('disk',10);
morphIm = imclose(edgeDetect,diskEnt);
segmentedIm = imfill(morphIm,'holes');
*********************************************************************

At this stage we have your 'segmented' image (segmentedIm), which is black and white. Now it gets complicated. It is important to define what you mean by the term 'area'. I noticed you were using the function bwarea(). This function estimates the area of a given pixel due to it's 2x2 neighbourhood.

If it is a literal area ratio you are looking for (as in the amount of space occupied), then I would suggest using the number of pixels for the measure of your area - as this is common to both your segmented image and the original greyscale image. The amount of white pixels (remember the white pixels are your segmented image and therefore the amount of white pixels represent the amount of pixels in the segmented image) can easily be determined with:

segArea = length(find(segmentedIm == 1));

Now you want to compare this to the amount of pixels within your original greyscale image. As mentioned previously, this is simply the result of the product of the width and height dimensions of your image, or:

origArea = size(greyIm,1)*size(greyIm,2);

Now your ratio of extracted pixels can easily be determined:

areaRatio = segArea/origArea;
From: saurabh pandey on
"Christopher " <christopher.badman(a)au.saabgroup.com> wrote in message <i0c46n$fdt$1(a)fred.mathworks.com>...
> "saurabh pandey" <sathiya_saurabh(a)yahoo.co.in> wrote in message <i0c2gd$q9o$1(a)fred.mathworks.com>...
> > ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <62e96cdf-2c99-4939-8e14-fd943c8f8e14(a)c33g2000yqm.googlegroups.com>...
> > > The area of *what*? Those are very complicated images with lots of
> > > weird looking, ill defined things in them. It's not really clear
> > > what is to be measured, and it's not clear what you're even asking.
> > > If we go by exactly what you ask -- "calculate the area of image" --
> > > then we'd just say that the area is the number of pixels in your image
> > > (converted to real world units such as mm^2 if you wish). I'd have a
> > > tough time segmenting anything out of those images so if you just need
> > > the area of some subset of objects in there, I'd use your expert human
> > > knowledge and manually outline them. Heck, even with manually drawing
> > > them I think there would be lots of judgement calls as to where to
> > > draw the lines. There is nothing distinct enough in the images, and
> > > the images aren't even similar enough, to waste time trying to develop
> > > an automatic algorithm for them (unless that's the whole point of your
> > > dissertation work).
> > >
> > > I don't have any code to send you, but you said that you already has
> > > code that segmented something out of those images. I'd be interested
> > > in seeing that code because I have no idea what it could possibly find.
> >
> >
> >
> > thank you very much for your support.
> > as you told i calculate the area of image using regionprops by converting it to binary by im2bw.now i find edges by using canny and sobel operator which are also binary images.can i calculate area for that image? is this perfect for analysis purposes?
>
> Your description is confusing but let's see if this is what you want.. From what I can gather you have an initial greyscale image. You use an edge detection algorithm and then morphological operations to estimate a segmented image. This segmented image will now be a black and white image, with the white pixels representing the "image" and the black pixels representing the "background"...
>
> You now wish to determine the ratio of the segmented image to the original image as a measure of the fraction of image segmented from the original..
>
> I would assume something like this:
> *********************************************************************
> % read in the original image
> greyIm = imread('testIm.jpg');
>
> % perform edge detection (example threshold)
> edgeDetect = edge(greyIm,'Canny',0.4);
>
> % perform morphology
> diskEnt = strel('disk',10);
> morphIm = imclose(edgeDetect,diskEnt);
> segmentedIm = imfill(morphIm,'holes');
> *********************************************************************
>
> At this stage we have your 'segmented' image (segmentedIm), which is black and white. Now it gets complicated. It is important to define what you mean by the term 'area'. I noticed you were using the function bwarea(). This function estimates the area of a given pixel due to it's 2x2 neighbourhood.
>
> If it is a literal area ratio you are looking for (as in the amount of space occupied), then I would suggest using the number of pixels for the measure of your area - as this is common to both your segmented image and the original greyscale image. The amount of white pixels (remember the white pixels are your segmented image and therefore the amount of white pixels represent the amount of pixels in the segmented image) can easily be determined with:
>
> segArea = length(find(segmentedIm == 1));
>
> Now you want to compare this to the amount of pixels within your original greyscale image. As mentioned previously, this is simply the result of the product of the width and height dimensions of your image, or:
>
> origArea = size(greyIm,1)*size(greyIm,2);
>
> Now your ratio of extracted pixels can easily be determined:
>
> areaRatio = segArea/origArea;


sorry sir you didn't get me.actually i take a input image of say coins.png.apply some morphological operation by converting it to binary by using im2bw.now i get some segmented image,find its perimeter and then i overlay this perimeter on the original gray image,and find area of orginal image as well as segmented image by regionprops.
now again i want to compare my method with other methods like canny,sobel etc. so i find edge by canny edge detecter and overlay that image of edges on the original image.that is i found the segmented image by canny method.now i have the area of original image but i don't have the area of segmented image by canny.so i want to ask that can i find the area of that image containing edges by canny by using regionprops or bwarea or by code which you provided.
or can i use any other method for finding my code is better than canny,sobel
?
 |  Next  |  Last
Pages: 1 2 3 4 5
Prev: mse
Next: UDP communication with dynamic server port