Get Real distance value in an image.
Show older comments
After using the comparison method between two image, i want to detect the real length value of the red Lines. For example 5 cm. So i can know the distance the object has moved. Is it doable automatically ?
Accepted Answer
More Answers (1)
Florian Morsch
on 10 Aug 2018
Edited: Florian Morsch
on 10 Aug 2018
0 votes
With a given reference its possible. Either calibrate your camera to that reference and dont move it afterwards or have a known scale on each image. That way you can tell what distance equals a pixel. Now you just have to count the pixels and can convert that to your distance.
And yes, you can do it automatically. If the camera is calibrated to the reference, just count the pixels and convert them. If you have a scale on each image, detect that scale, count the pixels and (since you know the real dimensions of the scale) use that to calculate the distance.
6 Comments
Theodor Al Saify
on 10 Aug 2018
jonas
on 10 Aug 2018
What you are trying to do is definitely possible. You say that the scale is present in the figure, however not in the one you attached. However you insert this scale (can be a physical scale in the photo), make sure it is clearly distinguishable from the background so as to make the detection easier. Even better if it's a distinct color, like bright red on a dark background.
Theodor Al Saify
on 10 Aug 2018
Theodor Al Saify
on 13 Aug 2018
jonas
on 13 Aug 2018
Yes, now you should be able to detect the scale. If I were you, I would pass the question to Image Analyst, as he will be able to give you the best guidance on what method to use. If you can segment the red color, then it should be easy to find the axes and count the number of pixels in the y- and x-directions.
You can start by looking at the demo on color segmentation by IA.
Categories
Find more on Contrast Adjustment in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!