If you have a binary mask for each line segment, could you take the maximum remote conversion in that segment? It should tell you how far from the center of the line from the edge, the width should be 2*max(distanceTranform(segment)) - 1
for odd width and 2*max(distanceTranform(segment))
for uniform width.
OpenCV has an implementation of this method here . They also have HoughLinesP for defining line segments, but it looks like you already developed it.
source share