Average width of lines
이전 댓글 표시
Hi all,
I want to know the procedure to calculate the average width of white lines in the image below.

Is it also possible to measure the widths at many different places?
Thanks
댓글 수: 1
Jan
2013년 9월 30일
The problem is not well defined. What should happen at the intersection of the two lines? Does "width" still mean the minimal distance from one point on the edge to the points of the opposite edge? But the "opposite edge" belongs to the other line at the intersections. How is the "width" defined at the limits of the picture? In the lower left there might be some points, where the minimal distance cross some black pixels - is this valid?
The question is far from being trivial when you define it exactly. Only simplifications would allow to determine an "average width", but the exact definition of the problem cannot be guessed automatically, but this is your turn.
채택된 답변
추가 답변 (2개)
Jan
2013년 9월 30일
0 개 추천
Some illustrations about the points, where I do not see a unique definition of "width":

Overlaps of more than 2 lines might occur also as well as lines which overlap the edge of the image of a wide range.
Anand
2013년 9월 30일
0 개 추천
Another (more complicated and time-consuming) approach to try is the following:
1. Use edge to find edges in the image. Adjust the parameters to make sure all line segments are found. Use morphological functions like imdilate/imerode to get continuous line segments.
2. Use the hough function to find the Hough Transform of the image.
3. Find peaks in the Hough Transform. Adjust the thresholds enough to find peaks for all your desired line segments. Keep in mind that the horizontal and vertical line segments may come in as well.
4. Use the houghlines function to find coordinates for line segments found. Do some post-processing to eliminate unwanted lines.
5. Find parallel line segments by comparing the slopes of the lines (slope of a line can be found using (y2-y1)/(x2-x1)).
6. Find the perpendicular distance between the lines.
댓글 수: 3
M
2013년 10월 1일
Ningjing Zhang
2022년 2월 17일
How to perform some post-processing to eliminate unwanted lines?
Image Analyst
2022년 2월 17일
@Ningjing Zhang You have to make a mask of the ones you want to erase and then do
binaryImage(maskOfLinesToErase) = false;
of course how to get maskOfLinesToErase depends entirely on how you define which lines are not wanted.
카테고리
도움말 센터 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!