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.
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"