- First, you need to segment the scale bar using any segmentation function, for example imbinarize (using a small threshold)
- Then, using regionprops (with the inverted mask, ~BW)you can obtain the length of the segmented objects using the property 'MajorAxisLength'. If the threshold is good enough, the object with the maximum length should be your scale bar.
how to find size of scale bar on image
19 views (last 30 days)
Show older comments
I have converted the image I've attatched into matrix form, but I'm wondering is there away to go through each pixel of the image until the first black pixel (eg the first black pixel on the scale bar and the last black pixel on the scale bar) is detected? I'm trying to work out the length of the scale bar in pixels. I'm really new to MATLAB so if anyone could help/explain It would really help me out.
0 Comments
Answers (1)
Alex Mcaulley
on 10 Jan 2020
One approach would be:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!