Finding area, length, width, Height of leaf

Papabravo

Joined Feb 24, 2006
21,159
Sure. You know the total size of the image in pixels. The area of the leaf is the number of white pixels times a constant of proportionality to convert to actual units of length^2.
Then you count the white pixels in each row and in each column. You can use the maximum of the row counts and the column counts or you can average them.
 

WBahn

Joined Mar 31, 2012
29,979
Hi guys,

Please I want to calculate the area, height, width and length of these binary leaf in Matlab. Can anyone please help me out on how to do this, thanks.
First, you need to define your terms better. When used together, "height", "width", and "length" imply a three-dimensional volume of some type.
 

Thread Starter

Mannipuccho

Joined Nov 6, 2014
24
Sure. You know the total size of the image in pixels. The area of the leaf is the number of white pixels times a constant of proportionality to convert to actual units of length^2.
Then you count the white pixels in each row and in each column. You can use the maximum of the row counts and the column counts or you can average them.
Hi Papabravo,

I am not good with matlab as I am still finding my way through it, is it possible to put your explanation in a MATLAB code for please so that I can understand it much better.
 

Papabravo

Joined Feb 24, 2006
21,159
I'm sorry but I do not have a licensed copy of Matlab. I had a student copy back in 2001-2004 when I went back to graduate school, but that expired when I graduated and the laptop it was installed on has gone to the rainbow bridge. So you're just SOL. PS I was never very good with it either.

Suppose I give you a single dimension array representing a line from your image and say that any value less than 20 is black and any value greater than 220 is white.
a = [4,5,5,5,6,7,240,241,244,245,10,9,8,7] ;
and ask "what is the length of the white section?"
Could you do that?
 

Thread Starter

Mannipuccho

Joined Nov 6, 2014
24
Ooh nooo, I didn't mean to write that, it was a typo from my phone, I meant thanks a lot for the help. I spent last night figuring it out and finally got what I needed. My bad Whan and Papabravo if I sounded harsh earlier on.
 

Papabravo

Joined Feb 24, 2006
21,159
That's a relief. We're all glad you figured it out. If I could ask a small favor. Could you write a paragraph on how you feel about the process of figuring things out for yourself as opposed to having a solution handed to you?
 

GopherT

Joined Nov 23, 2012
8,009
That's a relief. We're all glad you figured it out. If I could ask a small favor. Could you write a paragraph on how you feel about the process of figuring things out for yourself as opposed to having a solution handed to you?
Chirp...
Chirp....
 
Top