# Digital Measurment Estimator

3,203

10

4

## Introduction: Digital Measurment Estimator

Have you ever wanted to get an approximate measurement from a digital photo and never knew how.

Here is one way to do this.

I completed this instructable using three items. 1) Framing Square (24 x 16 inches), 2) Digital Photo, 3) MS paint.

I saw this software program on the internet at: http://www.stickyyard.com/

I wanted to challenge myself to see If I could recreate the function without the expense.

Soo.. Here it goes.

Please keep in mind that this is only an estimator and will not provide precision measurements. There are many factors that could affect your results. This should get you close if you do not have any other tools available.

Here is my first subject, my garage door. I want to find the length and the height around the frame of the door.

## Step 1: Reference Object

Now that I have something I want to measure I need to have a reference object. I happened to use a framing square in this instance. I propped this up against the garage door, this can be seen at the lower left hand corner. This framing square measures 24 x 16 inches.

From here on out it starts to get in depth. I will divide this up into two sections. One for the casual reader and one for the techno / geek / engineer in all of us.**CASUAL:**

The idea of this project is to scale up a known size to determine an unknown size.**TECHNO, GEEK, ENGINEER:**

Of course the accuracy in doing this will be largely affected by a multitude of variables, not all of which I can or will address, but I will try to explain a few. Please remember I am not an expert so those of you that are, please enlighten me on my mistakes.

## Step 2: Paint Program

There are a couple of things to consider before getting started.

Using this technique you should consider the following:**Casual:****1 ** Select an object that only has two dimensions (flat).**2** Include a reference object of known size in the picture, place this as close to your subject object as possible (this will increase your accuracy).**3 ** Any digital camera should work. Make sure your subject object is squared nicely in your picture. Take a picture from a point that is perpendicular to your subject.**4 ** Download your pictures and open them up in MS Paint.**TECHNO, GEEK, ENGINEER:****1 ** I suppose a 3-d object could be your subject but to keep the math more realistic I prefer to only work with 2-d objects. Other wise you will need to take depth/perspective and complicated scaling into into account.**2 ** Any object with a known size should work, ideally the larger the object the more accurate your measurements will be. However, if your reference object is too large it may be easier to actually measure your subject instead. Try to keep your known object in the same plane as your subject object because any offset in your plane will affect the accuracy of your work.**3** A picture with a higher number of pixels/inch will result in a more precise measurement but this is just an estimator and there comes a point where the increased precision is useless. Consider your goals/expectations and realities when when selecting the picture resolution.

Square the subject object nicely in the picture because the amount the object is skewed from the reference axises is reduced and it helps to eliminate inaccuracy's and calculations. When taking a picture remember to take a picture from a point that is perpendicular to your selected object, this will help to reduce skew errors with the picture.**4** I wanted to use MS paint because it is a program just about everyone has and it is easy to work with. I have also noted that with some fancier photo editing software, when zooming in to individual pixels the resolution seems to be lost/degrade. (I don't know why this happens maybe someone can explain this)

## Step 3: Zoom in on Your Reference Object

Now that you have brought up your picture into MS Paint you can start working with it.**CASUAL:****1 ** Zoom into your known object.**2 ** Select points on your reference object with a known size**3** Record the pixel location (found at the lower right had corner of MS Paint)**4** With this object I selected three points each one as far apart as possible.**5 ** Each pixel position is identified by an x and Y coordinate and is noted in this fashion (X,Y)**6 ** For these three points the x,y coordinates are: (396,1013) (512,1011) and (512,934)**TECHNO, GEEK, ENGINEER: ****1 ** Zoom into your known object. Zooming in super close really doesn't help too much remember this is only an estimator. In addition the picture needs to have a higher resolution for this to be more effective/accurate.**2** Select points on your reference object.**3 ** Record the pixel location (found at the lower right had corner of MS Paint)**4 ** With this object I selected three points each one as far apart as possible. I selected the points as far apart as possible to give me the greatest accuracy with my measurement and calculations.**5 ** X, Y Cartesian coordinate system; X axis is parallel to the bottom of the screen.**6 ** For these three points the x,y coordinates are: (396,1013) (512,1011) and (512,934)

## Step 4: Determine the Distance Between Dots - X Axis

Lets start by looking at our reference object and measurements along the X-axis.**CASUAL:****1 ** To find the distance in pixels look at the numbers you just recorded and subtract one X value from the other. **2 ** In this instance the dot locations are (512, 1011) and (396, 1013).**3 ** So, 512 - 396 = 116 pixels wide along the X axis**4** We also know that the framing square is 24 inches long.**5 ** So 116 / 24 = 4.833 pixels per inch**TECHNO, GEEK, ENGINEER:****1** The linear distance is not completely accurate along the X-axis because of the the difference in the Y axis is 2 pixels. I choose the X axis to start off with because it is the longest axis and it should yield slight more accurate results than choosing the smaller Y-axis as my initial reference.**2 ** In this instance the dot locations are (512, 1011) and (396, 1013).**3 ** So X = abs(512 - 396) = 116 pixels and Y = abs(1011-1013) = 2 pixels; so the true length of this line is actually solved this way: line along X axis = Square root(116^{2}+2^{2}) = 116.0172**4 ** We also know that the framing square is 24 inches long.**5 ** So the true number of pixels per inch is actually: 116.0172 / 24 = 4.834 pixels per inch

## Step 5: Verify the Scale of the Image

OK so now we know how many pixels per inch we are dealing with. Lets verify this using the Y-axis as a control.**CASUAL:****1** What is the number of pixels from the bottom of the framing square to the top?**2 ** The location of the yellow dots are along the Y axis are: (512, 934) and (512, 1011)**3 ** The number of pixels along the Y axis is: 1011 - 934 = 77 pixels**4 ** We also know the number of pixels per inch along the X axis is 4.833 pixels per inch**5 ** So we can now determine the length of the framing square along the Y-Axis:

77 / 4.833 = 15.931 inches in length **6** Now we know that this should have came out to be 16 inches so there is a little error in our

measuring technique. Remember this is an estimator it will not provide you with exact measurements.**TECHNO, GEEK, ENGINEER:****1 ** What is the number of pixels from the bottom of the framing square to the top?**2 ** The location of the yellow dots are along the Y axis are: (512, 934) and (512, 1011)**3** The number of pixels along the Y component is: ABS(934 - 1011) = 77 pixels the number of pixels along the X component is ABS(512-512)=0 pixels. So the true length of the framing square in pixels is: Square root (77^{2}+0^{2}) = 77 pixels**4** We also knowing the number of pixels per inch along the x axis is 4.834 pixels per inch**5** So we can determine the length of the framing square along the Y-Axis:

77 / 4.834 = 15.929 inches in length **6** Now we know that this should have came out to be 16 inches so there is a little error in our

measuring technique. Using the CASUAL technique the error works out to be (16 - 15.931)/16*100 = 0.43% Using the TECHNO technique the error is closer to (16 - 15.929)/16 *100 = 0.44%

## Step 6: Now Let's Measure the Header Trim Above the Garage Door.

I am going to use the same technique that we just used on the framing square to figure out the length of the header trim.**CASUAL:****1** What is the number of pixels from one corner of the header trim to the other?**2** The location of the yellow dots are along the header trim are (X axis) are: (345,582) and (1276,593)**3** The number of pixels along the X axis is: 1276-345 = 931 pixels**4** We also know the number of pixels per inch along the X axis is 4.833 pixels per inch**5** So we can now determine the length along the header trim (X-Axis):

931 / 4.833 = 192.634 inches in length**6 **Now lets measure the header trim to see how we did. It looks like we came out with a measurement of 199.625 inches. That is pretty close for an estimate. Remember, this is an estimator it will not provide you with exact measurements.**TECHNO, GEEK, ENGINEER:****1 **What is the number of pixels from one corner of the header trim to the other?**2 **The location of the yellow dots are along the header trim are (X axis): (345,582) and (1276,593)**3** The number of pixels along the X component is: ABS(345 - 1296) = 931 pixels the number of pixels along the Y component is ABS(582-593)=11 pixels. So the true length of the header trim in pixels is: Square root (931^{2}+11^{2}) = 931.065 pixels**4** From earlier also know the number of pixels per inch along the X axis is 4.834 pixels per inch**5** So we can determine the length of the framing square along the Y-Axis:

931.065 / 4.834 = 192.608 inches in length**6** Now we know that this should have came out to be 199.625 inches so there is a little error in our measuring technique.

Using the causal technique the error works out to be (199.625 -192.634 )/199.625*100 = 3.5% Using the Techno method the error is closer to (199.625-192.608)/199.625*100 = 3.52% **7** At this point you are probably saying to yourself, "Hey! using the framing square the error was about 0.44%, why has this increased?" Well the reason for this is because the error increased in proportion to our measurement. Lets look at the Techno method: our header distance was actually 199.625 inches, and our X axis framing square was 24 inches. So 199.625/24 = 8.318. I would expect the error to increase by a multiple of that amount. Lets see: 8.318 * 0.44% = 3.66%, Guess what our actual error increased by 3.52% So our measurement was quite accurate after all (this type of error can be reduced by increasing the size of your known object).

## Step 7: Now Lets Measure the Side Trim on the Garage Door.

Again I am using the same method that we have used previously.**CASUAL:****1** What is the number of pixels from top corner of the side trim to the other?**2** The location of the yellow dots are along the side trim are (Y axis) are: (345, 584) and (343, 1023)**3** The number of pixels along the Y axis is: 1023 - 584 = 439 pixels**4 **We also know the number of pixels per inch along the Y axis is about 4.833 pixels per inch**5 **So we can now determine the length along the side trim (Y-Axis):

439 / 4.833 = 90.834 inches in length**6 **Now lets measure the side trim to see how we did. It looks like we came out pretty close to 89 inches. Not too bad.**TECHNO, GEEK, ENGINEER:****1** What is the number of pixels from top corner of the side trim to the other?**2** The location of the yellow dots are along the side trim are (Y axis) are: (345, 584) and (343, 1023)**3** The number of pixels along the Y component is: ABS(584-1023) = 439 pixels the number of pixels along the X component is ABS(345-343)=2 pixels. So the true length of the header trim in pixels is: Square root (439^{2}+2^{2}) = 439.004 pixels**4** From earlier we also know the number of pixels per inch along the X axis is 4.834 pixels per inch**5** So we can determine the length of the framing square along the Y-Axis:

439.004 / 4.834 = 90.816 inches in length**6 **Now we know that this should have came out to be 89 inches so there is a little error in our measuring technique.

Using the CASUAL technique the error works out to be (90.834 -89 )/89*100 = 2.06%

Using the TECHNO method the error is closer to (90.816-89)/89*100 = 2.04% **7** Again the error is larger than the error we initially calculated but by looking at the how the error scaled up it again works out to be pretty close to what we would have expected. The actual length of the side trim turned out to be 89 inches. We also know that our reference object was 16 inches high. So 89/16=5.5625; Now, multiply 5.5625 by the initial error we calculated to determine the potential error with the final measurement. Lets do this with the casual measurements first. 5.5625 * 0.43% = 2.39% So using the CASUAL method we were again quite close to the measurement that we expected. Lets now apply this to the TECHNO method: 5.5625 *0.44% = 2.45%. As expected the error is quite low.

## Step 8: What Have We Learned?

**For the average person it is possible to obtain quite an accurate measurement from just a photograph. **

If you intend to try this out remember a couple of key points to make things easier. **1** Select a 2-D "flat" object.**2 ** Select a reference object that is as large as possible.**3 **Take a picture from a point that is perpendicular and centered on the subject object.**4 **Try to keep the subject object as squared within the picture edge as possible.**5 **Keep your reference object as close to your subject object as you can.

For the TECHNO, GEEK ENGINEER in all of us.

This instructable is not 100% accurate and could use some help. Below are a list of potential errors as I see it and problems that I have not or failed to address. Remember this is only intended as an estimator and not for truly accurate measurements.**1 **My subject object is pretty close to 2-D.**2 **My reference object is set about 6 inches or so back from the subject object, this introduces an additional scaling error.**3 **The picture was not taken from a point that is perpendicular to the subject object.**4 ** I tried to simplify the math in for the CASUAL method so that the broadest community would understand what I was trying to accomplish.**5 **The scale of the subject object would be larger on one end than the other because of perspective issues associated with the lack of perpendicularity.**6 **The vertical error measured on the 16 in framing square was less than the actual length of the object where as the vertical error on the side trim was more than the actual length of the object. Although I knew about this problem I made the assumption that the error was bilateral and not just unilateral and so the error would be assignable to both sides of the actual measurement.**7 **The vertical error was assigned to the horizontal measurements. This assignment may or may not be applicable. I made the assumption that the vertical error was an approximately correct and applied this to the horizontal measurements as well.**8 ** You can see that if proper care is taken the additional steps of finding the true length calculations are not necessary. When one compares the CAUSAL to the TECHNO styles there is very little practical difference. I believe that the TECHNO method would be more appropriate if the subject object was not squared as nicely within the picture.**9 ** I do not believe that using a higher resolution graphics file would result in a more accurate measurement. The precision in selecting individual points would increase but the additional time and effort in analyzing this type of file would increase. Using a higher resolution photograph would also reduce potential error. Personally, I would select a reasonable resolution graphic and work with this. However, If you are working for the US Military and needed to select individual targets in some foreign country I would recommend using a higher resolution graphic.

What is a practical application for this instructable?

1 - Siding estimator - estimate the amount of siding needed for a wall.

2 - Measure your ex-girlfriends apartment without stepping foot inside.

3 - Figure out how far apart your neighbor's houses are

4 - Figure out the height of a flag pole

5- etc. etc. etc.

If you would like to learn more about this subject search the web for photogrammetry http://en.wikipedia.org/wiki/Photogrammetry

Knowledge of descriptive geometry would also be useful if one was to seriously consider this type of work. http://en.wikipedia.org/wiki/Descriptive_geometry

If you have not seen it already, take a look at my other Instructables:

https://www.instructables.com/id/Hanging-around/

https://www.instructables.com/id/Volume_of_a_Cylinder_2/

https://www.instructables.com/id/476_better_than_a_Bank/

## 4 Discussions

You'll also find that there's a certain position on your camera's zoom (assuming it has a zoom) that gives minimal image distortion (barrel or pincushion distortion), and so straight lines will appear straighter in the final image. Using that zoom setting and standing directly in front of the item to measure should give more accurate readings.

great instructable:) i vote for you:)

Great instructable! This works really great most of the time

I noticed you took the picture from a slight angle. You should take your pictures from straight onto avoid the perspective. You may notice that your garage door gets skinnier towards one end. That could really throw off your estimations. Just thought that might help. Although I noticed you already wrote that I thought I would explain that.