# Image analysis: Finding the cusp spacing

4 views (last 30 days)
Shan Kapoor on 20 Sep 2011
Hi all,
I am stuck with an issue.Please forgive and redirect me if these type of problems are already addressed.
Please refer the following picture, https://picasaweb.google.com/116243239493929305987/ImageAnalysis#5654551982275072578, I would like to measure the spacing between the cusps of the long black laths...Right now I am doing it manually by drawing a bisector to the lath and measuring the length to the hill and the valley ( as shown in red line in figure). As analysing hundreds of images in this way is a huge task, it will be of great help if you give me some guidance on how to automate this thing in matlab. Thanks in advance
Image Analyst on 27 Sep 2011
I'm sorry but this if far too involved and complicated to answer in an online message. And I can't take on a paid consulting job like this right now. I still don't know what you're looking for and I couldn't even do it manually if I had to. Even for you I bet there are a huge number of judgment calls on what is or is not a feature you want to count. If and when you do figure it out you could probably get a paper out of it.

Walter Roberson on 27 Sep 2011
When you say "putting an aspect ratio", do you mean you are excluding any black area whose major to minor axis ratio exceeds 3 ?
It appears to me that the automatic steps consists approximately of the following:
Binarize with a low threshold that converts gray and upwards to white. It might be a bit tricky to have the gray area in the upper left blue circle left out (converted to white) but not the circular-like gray area in the upper center blue circle. If a good simple threshold cannot be found, then you might need to use more advanced techniques based upon contrast with adjacent areas. "watershed" filtering perhaps.
Once you have the binary image, negate it (0->1, 1->0), so that the solid black crystals become solid white and everything else becomes a formless mass of black.
label the image; bwlabel() is the older routine and I have not memorized the name of the newer routine yet
Let the ratio of permitted major axis to minor be R -- e.g., 3 in your case. Define g = (R-1)/R. Then calculate the eccentricity, e, of the ellipse is sqrt(g*(2-g)). For R=3, you should come out with e = 2/3 * sqrt(2), I calculate.
regionprops() the labeled image. Throw away all portions whose eccentricity as measured by regionprops is greater than e
If you like, add additional "common sense" rejection of the regions, such as throwing out areas too small or too large to be relevant.
In theory, with luck, what remains should be information about the globular regions.
It would not surprise me if, after you negated the thresholded image, you had to do an imerode step to separate adjacent regions better.

Tolga Birdal on 23 Jan 2013
Edited: Tolga Birdal on 23 Jan 2013