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?
For a rough estimate, I'd just sum up the image to get the area, then skeletonize the image and sum up that image to get the total length. Then divide the area by the length. Will that work for you? If it's not accurate enough then explain why not, and what specific level of accuracy you require.
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.
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.
Play games and win prizes!Learn more