0

I'm trying to measure the horizontal length of a scale bar in Matlab:

enter image description here

I realize that there is this question

But that max distance basically means that I will be taking the diagonal distance between the top left tip of the scale bar with the bottom right of this scale bar, wouldn't it? Mine is much straighter with the redundant tip at the sides.

Is there a more accurate way of measuring it?

Community
  • 1
  • 1
Keyes34
  • 171
  • 9
  • Silly question: do you need to do that automatically? I guess so but that's worth asking haha. – Benoit_11 Jun 30 '15 at 16:19
  • Oh yes, I do. +++++ – Keyes34 Jun 30 '15 at 16:25
  • Another silly question: Is it always horizontal, or can it be angled? And how are you detecting the scale. Do you already have it identified in a binary image or something? – beaker Jun 30 '15 at 16:54
  • 1) They will all look like that with varying length, so yes, they are all horizontal. 2) The program looks for the top left region of an image with `ScaleBox = original(1:50, 1:220, :, :) ;` where original is the original image, ScaleBox = the above binary image, after filtering small areas by using the code in the link above. – Keyes34 Jun 30 '15 at 17:05
  • 4
    In that case, why would it not be `max(col)-min(col)+1`? – beaker Jun 30 '15 at 17:14
  • @beaker the `max(col)` is a bit misleading (I hope by `col` you mean column because `col` usually means color) I would reformulate your comment to: found `min` and `max` `x` coordinate from all white pixels and then the length is `xmax-xmin+1` (bounding box in 1D) so it is comprehensible for anyone not just those who nows how to do it. – Spektre Jul 01 '15 at 07:12
  • @Spektre Yes, I mean column. Thanks for your clarification. – beaker Jul 01 '15 at 14:58

0 Answers0