Intensities along border of cylindrical object
Afficher commentaires plus anciens
Hi,
I want to measure and plot the intensities of a signal along the border of a cylindrical object.

The plot should be intensities over border length/coordinate. I have a lot of objects that kind of look like in the picture. They are orientated in all kinds of directions. My algorithm so far as an outline:
- Segmentation of objects
- Create label image
- Get region properties via regionprops ( Here I'm mainly interested in all the ellipse related values)
- Then for each objects get the Centroid and compute the point where the ellipse main axis intersects with the border of the object
- Walk along the border of each object using bwtraceboundary
- With these Locations measure intensities of these points
With this I have two major problems right now: First I get the centroid and compute the intersection point using MajorAxisLength*sind(Orientation) and *cosd(Orientation). But this gives me a numerical value like 4.8 22.4 What would a good way to find the nearest nonzero pixel of the perimeter image? (Image with only object border)
My second problem is that in this approach I will only get the intensities along a one pixel line. I would prefer to get the average along the line of a certain width, say 5 pixels. My idea would be to just do the trace, subtract the perimeter and then do the trace again so and so many times and then average the intensity values of corresponding values. But this sounds rather inefficient. Would there be a better way to address this?
Thank you very much for your help!
Réponses (1)
Image Analyst
le 27 Oct 2014
1 vote
I'd threshold, fill, find the centroid. Then use improfile() to send out rays from the centroid at a bunch of angles between 0 and 360 degrees. Then get the average of the non-zero values. Not too hard. Give it a shot. If you can't figure it out, come back and ask. Or if you need something more accurate (because the shape is not always perpendicular to the rays at the intersection point) - there are more complicated and accurate ways.
6 commentaires
Image Analyst
le 28 Oct 2014
So you have the ring segmented. Then you can skeletonize it to get the centerline. Then pick a point to start at. Then take a stretch of pixels along the skeleton, say 11 points. Put them into polyfit() to get the equation of a polynomial going through them, say a quadratic or cubic, using polyfit. You can construct the derivative of the polynomial using simple calculus. Knowing the locations of the coordinates and the coefficients from polyfit, you can determine the slope of the line at that point. Take -1/slope to get the slope of the perpendicular line. Using the point slope formula, get two endpoints of the perpendicular line that cut across the ring and call improfile. Get the mean of the non-zero parts of the profile. Then move on to the next point.
I have done this for one project so I know it's possible.
David
le 31 Oct 2014
Image Analyst
le 31 Oct 2014
Sorry but that approach won't work, as you discovered. You can't use the orientation, midpoint, or major axis of the whole ring to get cross sections. That's what I suggested first and you rejected saying it was too inaccurate for your needs. In order to get cross sections perpendicular to the local axis, you're going to have to do what I described. It works - I've done it, but it's not trivial. One watchout is that the endpoints will flip on either side of the ring if the local curvature changes sign, and that could mess up your profiles if you were summing them, for example to get an edge profile of an embossment or something. Since your path curves in just one direction, and because you wouldn't care anyway if the profile were reversed, you don't have to worry about that.
I was working on a general purpose method to get the average perpendicular profile along a hand-drawn path but the code seems to have vanished from my computer. I'll continue to look for it.
David
le 31 Oct 2014
David
le 7 Nov 2014
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!