# how to calculate irregular shape area

hi,
i have the project that needs to me to develop the source code for calculate irregular shape area for cataracts in the iris of eye.i have the problem to do this solution.so,can anyone help me to make the solution.My project is for detect and extract the irregular shape and must calculate the area of irregular shape(region of interest).
«13

## Comments

• You can make a blak&white image, with a white region of interest and a black background, and then simply count the white pixel. The methods to be used to obtain the b&w image depends on the image characteristics.
• You can make a blak&white image, with a white region of interest and a black background, and then simply count the white pixels. The methods to be used to obtain the b&w image depends on the image characteristics.
• But how to count pixels ??
• But how to count pixels ??
• what do you mean with characteristic of image?what's example methods that you can give?how to calculate in pixel and do you know how to calculate in cm per square.
• If you have to count white pixels and your image is a double image (use im2double if it is not), the white pixel
• do you know how to count in cm per square for the area?
• You need to know the resolution of the image.
i.e. how many pixels in one cm, or how many dpi.
Then, you have only to multiply for the number of white pixels and you have the area in cm.
• Sorry, I hadn't read this post.
I try to explain.
If you have an image with a dark backgroud, and the object is ligther than the background you can use a pixel based segmentation: all the pixels that have their value smaller than a threshold become black, the pixels that have a value higher than the threshold become white. In this way in the b&w image, you have your object in white and the background in black. See the im2bw function in the matlab help for more references.
If the object in your image has visible edges, probably it is better to use an edge based segmentation. You filter the image with a "high pass" filter that enphatise the edges of your image giving a b&w image with the edges in white and the background in black (see the edge function in the matlab help). Then, you fill the edges (imfill function).

So, it depends on your image...
• i know about the value of dpi..so, how can i calculate the area?but i don't know the value of pixel in one cm..
• i have 96dpi horizontal resolution and 96dpi vertical resolution.so,how can i calculate the area?if i have 1540pixel,it's not logic to multiple that value.
• The problem is: how do you "create" the image? With a camera? or it was a film and you use a scanner to digitize it?
Is the area of the object refferred to a real object so that you have to know the actual size of the real object?

• oh..i don't know the real size of object because i just take a picture from google image.so,i have big problem.i need to get the real image.my image refer to cataract image.
• Ok, if you have a google image, probably you have no information about the camera. Imagine that the size of the object represented in a photograph depends also on the zoom used to take the photo and on the distance of the camera from the object.
So, I think that you need some reference in the image, like "this object is n cm wide, so n cm corresponds to m pixels, and so the area is...".

• so,in programming how can i calculate the area for that image?let say i just do like your statement.how the code should i do?
Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!