How to find the most common angle of line segments in a binary image

1 view (last 30 days)
I have a microscopic biological image which I have thresholded and cleaned up to produce a binary image. This image is mainly made up of almost parallel streaks of varying length which are the result of long fibres in the original image.
I want to determine the approximate angle from the x-axis of the direction of all these fibres. I have been playing around with the Houghpeaks function but am not sure whether it's the most appropriate tool. As far as I understand Hough space is akin to the space of infinite straight lines and the Houghpeaks function tells you which of these lines are most close to existing in your binary image. This sometimes gives me sensible answers but I'm not sure it's the best tool for my purpose.
What I really want is the average angle made by many often small line segments. Is a Hough transform a good start or is there a better way to go for this?
Thanks.

Accepted Answer

Image Analyst
Image Analyst on 5 Jul 2015
It sure would have been helpful if you had let us see your image. Other than that, since I'm working blind and guessing, I'd say to call regionprops() and get the origination, then get the average of those.
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Orientation');
allAngles = [measurements.Orientation];
meanAngle = mean(allAngles);
  1 Comment
mamounia
mamounia on 7 Jul 2015
Thank you very much. That seems to give me sensible answers. I am left wondering about which situations the Hough transform is most useful for.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!