필터 지우기
필터 지우기

How to find the distance between lines in a image in matlab

조회 수: 5 (최근 30일)
Sriram Badri
Sriram Badri 2015년 4월 29일
댓글: Jean Luo 2016년 7월 12일
Hi All, I am trying to learn how to process images in Matlab. I am trying to find the vertical distance from the upper line to the lower one. I have a few questions as to how to start the process. Do I need to convert the image to binary in order to find the edges? How can I get the count of the pixels between these two lines?
Any guidance would be greatly appreciated to get me started in the right direction.
Thanks!
Added a JPG file.

채택된 답변

Image Analyst
Image Analyst 2015년 4월 29일
They don't look quite perfectly straight to me, so do you want to assume they're perfectly straight, or do you want to fit a curve to them, like a quadratic or something? Also, do you need the average separation, or the separation on a column-by-column basis? And, can we assume that the garbage along the edges is something we can either zero out or crop away? And are the lines roughly horizontal in every single image, or can they be at any arbitrary angle, like 45 degrees or whatever?
  댓글 수: 9
Sriram Badri
Sriram Badri 2015년 5월 8일
편집: Sriram Badri 2015년 5월 8일
This part of the code separates the image and returns the image which only contains the lines. So for h = 2,3 I can see the part of the image which contains the lines. I have to write a program which automatically determines the line locations so I cannot possibly crop out the garbage on top and bottom of the image. Hence I get h to be from 1 to 4. Containing four parts i.e. the two lines which I want and the top and bottom garbage parts.
Jean Luo
Jean Luo 2016년 7월 12일
Hi, I actually have a very similar question as this. If you ever got the code to work, could you show it to me?

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

추가 답변 (1개)

Thomas Koelen
Thomas Koelen 2015년 4월 29일
With this function you can find the lines:
You get the coordinates from both lines and substract the top from the bottom one, that's the distance.
  댓글 수: 1
Sriram Badri
Sriram Badri 2015년 4월 29일
Hi,
Thanks. I think the solution is only of horizontal lines. But I need a general approach to measure the distance for all type of lines say even cured ones. I don't think the lines are always horizontal.

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

Community Treasure Hunt

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

Start Hunting!

Translated by