views:

197

answers:

2

Hello, I am trying to find the area of some regions on an image.

alt text

For example, I want find the area of the dark-large region on the upper left side. and I want to find the area of any of the closed geometry from the image.

How can I do that in matlab.

I looked online and I tried regionprops(), but it didn't identify the different regions.

+2  A: 

filter your image using 'imfilter'. use 'fspecial' to define your filter. Then use an active contour model to segment the large objects. google 'active contour matlab'. use the 'polygon' and area function to find the area of enclosed contours.

hkf
I tried some codes from the mathworks website for active contouring. some of them works, but I couldn't get any area, and it didn't work for the small regions!I thought about cropping the pic first, to eliminate any noise, then I used imadjust to adjust the contrast a little bit. I need any example to understand it better.
Beho86
You should be able to extract the x and y coordinates of a contour using [C,h] = contour(...). See http://www.mathworks.com/access/helpdesk/help/techdoc/ref/contour.htmlThen take a look at this link to find the area : http://www.mathworks.com/access/helpdesk/help/techdoc/ref/polyarea.htmlActive contours like any other image processing method are not perfect. You will have to experiment with parameters of the model to suit your needs. Also a good idea would be to do a literature search on active contour methods and implement them in MATLAB yourself. It should be fun!
hkf
A: 

To add to hkf's answer, you might want to apply some pre-processing to your image to make it easier to handle.

I think you're on the right track with noise reduction. Your contours look relatively easy to detect - maybe you could simply binarize your image, apply combinations of imdilate, imclose and imerode to take care of artifacts (this is mostly trial and error), then try detecting the contours.

Then, of course, the challenge is to find a recipe that works for all images, and not just one sample.

Kena
I like the method of using imdilate, imclose and imerode, but is there a way to erase all the noise around the main shape. I mean some objects are close to the border of the image and it's causing problems.I saw it some where on mathworks demos, but not sure under what name!
Beho86
http://drop.io/319wyiithat's the image I am working on. I wanna fill the white Areas inside, smooth the border and erase all this noise around it. I tried to use iclose and ierode, didn't really make a different.Thanks in advance
Beho86