# Width of a String/Line in an Image

I have been looking for a method to find the width of a line.

"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."

Can anyone please explain the following? 1. what is summing up to get image area? 2. what is summing up skeletoniized image to get length? I did not get this.

I have to find the thickness of a string from a given image. I can take the image of any dimension and quality I want. How do i measure the thickness of a string? That is what I was trying to resemble as width of a line. Essentially, thickness of a string can be thought as width of a line, I think.

Moreover, I can not assign any unit to my measurement i.e., m/cm/mm. So I have to measure some sort of ratio to represent the thickness and reach a decision.

My outcome should be Yes or No based on the thickness. For example, if the thickness is greater that a certain value I would not take the string to process.

The string can be made of anything.

• Your question is unclear. You want a method to find line width, and then provide solution to average width of monochromatic (black and white only) lines? – Evil Jun 10 '16 at 0:54
• 1. Please edit the question to make the problem statement clearer. What does "find the width of a line" mean? How is the line represented? What is the input? Can you provide an example? How do you plan to specify which line you want to find the width of? How do you plan to address the comments ("the problem is not well-defined"..) on the web page you link to? Your current question is too terse. 2. What is your best guess at the interpretation of those phrases? What possible interpretations have you considered? – D.W. Jun 10 '16 at 1:16
• 3. What research have you done? Skeletonizing is a standard concept in image processing and is even described in the obvious place on Wikipedia. If your question is answered in the obvious place on Wikipedia, you probably haven't done enough research before asking. We expect you to do a significant amount of research before asking, and to show us in the question what you've found. See cs.stackexchange.com/help/how-to-ask. – D.W. Jun 10 '16 at 1:16
• Edit should give self-contained question - no "edit" tags inside. Your measurement will be in px. What do you mean by string thickness? Font size? Text height? Single letter leg width? What if it changes? For example O will vary from 2 to 5 px, what then? Do you have font used or possibly size (of the font)? – Evil Jun 10 '16 at 23:46
• To further improve the question, please see here. – Juho Jun 11 '16 at 7:16

"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."

Input images is a binary image, thus either the pixel value will be zero(black pixel) or 255(while pixel).

Summing up the image gives the sum of all while pixels(black pixel are zero).

i.e., the area of whole white line

$Area = Sum/255$

After skeletonizing the image, the thick white lines become almost one pixel thick.

Summing it up will give the approximate length of the line.

Now, as we know the area occupied by the white line and length of the line.

Dividing them will result the thickness of the line.