Let's say we have an image like so
(source: curiousexpeditions.org)
Let's say we've already used filters and an edge detection algorithm in this pic. Now my goal is to measure distances (NOT actual distances, distance can be in any arbitrary unit) . eg: How do I find the length of the hall? (until the window)
Or the height of the bookshelves? How exactly do you place the "scale" and measure. I'm looking for ideas. However it would help if the answers were in terms of OpenCV.
The camera uses augmented reality technology (AR) to easily measure length of any object with your smart phone camera.
From Drawing Tool Shapes, drag the Measure tool shape onto the drawing page. Glue one endpoint of the Measure tool shape to one point you want to measure—the endpoint turns green to indicate it is glued. Then drag the other end to the other point. The measure tool shows exactly how far apart its end points are.
You have the angle in the phone's accelerometer. If you calculate the tangent of this angle and multiply it by the height of the camera lens, you get the distance.
It depends on what you're trying to do.
You mention you want to measure the height of the bookshelves. If its OK with you to consider the close area of the bookshelf "shorter" than the height of the end of the bookshelf at the end of the row, all you're looking for is to measure distance. Choose a unit of "pixels" and then measure the distance using the Pythagorean theorem. (x^2+y^2 = z^2)
What you're probably really looking for is to have the height of the near bookcase be the same as the height of the far bookcase. In that case, you have to have more information. You have to do a 2D -> 3D transformation: You have a 2D image and you need to reconstruct a 3D picture from that image. At that point, you need a 3rd piece of information, since you want 3 variables (X, y, z) from 2 variables.
You can definitely do this with OpenCV if you properly calibrate the system and have a second reference point (for example, a laser line). This is known as a structured light approach - see this link for more information or google "machine vision structured light"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With