How to draw line with arbitrary orientation through a random pixel and calculate the distance along it?

조회 수: 5 (최근 30일)
I am trying to process some SEM images of cellulose network. I have applied the gaussian blur filter and applied threshold to the original images to get the desired fiber network. Now what I want to do is generate random pixels. If the value at that pixel is '1' I know that I have landed inside the fiber network. Then I want to draw arbitrary lines through those pixels (at angle step of ,say, 10 degrees) and calculate the distance along the line to estimate the fiber diameter (the shortest of all those distances where value changes from '1' to '0',in both the directions, would give me the diameter). I have already obtained the representative diameter using these steps:
  1. threshold the image
  2. Calculate the area by summing up the image
  3. Find the edges using Canny Edge Detection. Calculated the perimeter by summing up the image
  4. Divide the area by the perimeter to get avg. Representative Fiber Diameter
What I am interested in is studying the diameter distribution along given fiber length and fiber orientation distribution. So calculating distance along arbitrary line from random pixels could help me. How should I do that?
Regards,
Rajesh

채택된 답변

Image Analyst
Image Analyst 2013년 12월 6일
I don't think that is a good algorithm. What I would do is to use bwdist() to take the Euclidean distance transform of the white fibers. Also take the skeleton of it with bwmorph(). Then multiply the skeleton by the EDT to get the distance of every centerline pixel to the nearest edge. Take the histogram of that to get the radius distribution. Multiply by 2 to get the diameter distribution. This will be way more comprehensive that your method because it samples every pixel, not just some limited number of random locations, and it will be more accurate than your method (for obvious reasons).
  댓글 수: 2
Rajesh
Rajesh 2013년 12월 9일
@Image Analyst: Thanks
I tried out the above algorithm and it worked out.
But the algorithm that I thought of would take care of the orientation distribution of the fiber network as well. How should I take care of this? Any suggestion on how to go about it ?
Cheers!
Image Analyst
Image Analyst 2013년 12월 10일
Use imgradient() to get the gradient direction. Multiply by the skeleton to get the gradient direction only at fiber centerlines. Then take the histogram to get the distribution.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Soumitra
Soumitra 2014년 1월 14일
Hi @image analyst, when i multiply ECD image with skeleton image it, it always show a black image and therefore histogram was a single line. pls help.
  댓글 수: 3
Soumitra
Soumitra 2014년 1월 14일
Hello Image Analyst and all,
I am trying to find out out the diameter and orientation of the individual fibers in a fiber matrix.I am trying an algorithm as advised by you before, that is threshholding,ECD operation and skeleton finding. Finally I am trying to multiply this ECD and Skeleton image but not getting the histogram dist for fiber diameter. I have attached my m file and figure. Anyone can help in this regards.
Lavanya
Lavanya 2015년 1월 14일
Hi ,
If you are using imgradient() on binary image, then the orientation will be shown only for the edges, thats the reason you get a blank image when you multiply it with skeleton image.

댓글을 달려면 로그인하십시오.


H z
H z 2017년 6월 5일
Hello Image Analyst, I am trying to use your interesting method for diameter and orientation of line. (ECD operation and skeleton). The ECD and Skeleton multiply but not getting width. for line. Pls guide.
  댓글 수: 2
Image Analyst
Image Analyst 2017년 6월 5일
Why not? Please start a new question and attach your code and your image.
H z
H z 2017년 6월 6일
thanks, pls find the question entitled "How to calculate the width of line (Distance of every centerline pixel to the nearest edge)?" best

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by