Intensities along border of cylindrical object

3 views (last 30 days)
David
David on 26 Oct 2014
Commented: David on 7 Nov 2014
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!

Answers (1)

Image Analyst
Image Analyst on 27 Oct 2014
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 Comments
David
David on 31 Oct 2014
I feel like there's a misunderstanding. I'm trying to implement your second approach. As I said since it seems to be exactly what I need. So I want to take point on the middle ring. From this take some pixels ( say 5 in each direction) in clockwise and counterclockwise direction. Then do a polynomial fit. Then compute the perpendicular slope and then compute the average along this perpendicular curve and this is my intensity profile for this value. Then move on to the next pixel in counter clockwise direction and do the same thing again. In the end I will have an average intensity across the border for each point on the middle ring. This is fine. The only problem I'm facing is that I want to have a reproducible starting point. Meaning the first point on the middle ring where I will start this procedure. I don't want to take any point on the middle ring but rather one (of the two) that lies on the major axis of the ellipse. So I will get the same profile for the same object no matter at which angle it is orientated in space. (If I rotate my above image by 30° the algorithm should give me the exact same profile, not the profile shifted by a value). What would be a good way to find this point on my 1 pixel middle ring line?
David
David on 7 Nov 2014
Ok I solved the problem of finding a starting point by computing all the distances of points from the perimeter/middle line to a line corresponding to the major axis and choose the minimum value. I think there could be a smarter/more efficient way. Let me know if you know one. Now I will try to implement the polyfit.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!