title: Measure a length of a line segment in pixels from an image
body: <p>I have a ton of images like the one shown below. I am trying to detect nanoparticles from transmission electron microscopy images which I have successfully achieved using OpenCV-Python. The image is just a crop of the bottom left corner of a bigger transmission electron microscopy image. I would like to extract the length of the white colored line segment under the '100 nm'. Currently, I am manually measuring the length of this line and I would like to automate this. I think this could be done with OpenCV-Python by contouring, but I have lot of other features which are also contoured in the image.  I am new to Python and I am not very sure on how to implement this or if this can be implemented at all. My idea about what the code should do:</p>
  <ol>
  <li>Load the image</li>
  <li>Find the white line segment</li>
  <li>Return it's length in pixels.</li>
  <li>It would also be nice, if it detects what the number just above the line and returns it too.</li>
  </ol>
  <p>Any suggestions, directions or 'where to start' comments are greatly welcome and appreciated.</p>
  <p>The line is segment is very unique in its features and there is only one line in every image.</p>
  <p><a href="https://i.stack.imgur.com/4HQtp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4HQtp.png" alt="enter image description here" /></a></p>