# Estimate size from picture

I'm not sure this is the right place to ask this question. If not please point me in the right direction.

Question: is there a way to calculate the size of, say a back yard, or the walls in a room from a picture?

Update: Let's say someone has an android or iphone where the specs of the camera were known. If I just went into my back yard and took a few pictures could I estimate the size of my backyard or any backyard just from the picture. Maybe I could draw on the image lines that delineate the boundaries of the property.

-
Yes, there is a way. Please edit your question to provide more detail. What yard are you trying to measure with a picture? Are you using google maps to try and measure the square footage of your neighbor's house or something? – The Chaz 2.0 Apr 6 '12 at 16:38
lampShade -- that's like calling your kid "helmet" ;-) – joriki Apr 6 '12 at 17:09

For the back yard...

Go place three soccer balls or rubik's cubes or some objects in your yard, preferably so that two of them are equidistant along perpendicular lines from the the third and all are at the same height, if possible. Then take the picture with the full perimeter and the markers all in the field of view. It will greatly simplify the analysis, because you then have a two dimensional coordinate system. Next, we need to annotate the coordinate axes, and a closed curve representing the base of a wall bounding the yard at the same uniform height as the coordinate system you introduced. Then, we calculate the coordinates of this boundary using a projective transformation (which also needs to be modeled/annotated/calculated). Lastly, we can calculate the area from the 2D coordinates.

At this point, assuming you have done the annotations as two red line segments for the coordinate vectors and a blue curve for the perimeter (projected onto the coordinate plane), your best bet might perhaps be utilizing the Python interface to OpenCV to calculate a 2D parametrization of the perimeter, even on Android.

-
Where can I read more on this topic? I don't quite understand the solution you posed – lampShade Apr 6 '12 at 19:13
– bgins Apr 6 '12 at 21:55

You can do it in various ways depending upon the data you have. If there is something of known size in the image, you can use it for scale. If you know the focal length of the lens you can use geometry. In most cases you need to consider that the distance from the subject to the camera varies over the scene. Without better definition it is hard to give more of an answer.

In response to the update: the easiest is if you lie the phone on the ground and take a picture looking straight down so the yard is parallel to the image plane, though it would be better to have the objects closer in size. You can just scale by number of pixels-if the yard is 100 times as many pixels as the phone, it is 100 times as large. This works if the angles are small. If not, you are in for a bit of trigonometry and can draw the diagram to find the angles of interest.

If the items are not parallel to the image plane, there is perspective going on. It can still be resolved, at least sometimes, and again a diagram and trigonometry are your friends.

-
Where can I read more on this topic? I don't quite understand the solution you posed – lampShade Apr 6 '12 at 19:13