+1 tag for Google+

Monday, 30 December 2013

Finding out Camera Sensor Dimensions from a Diagonal Measurement

Just today I tasked myself to find out the sensor dimensions of a particular brand of a camera, for the possibility of matchmoving footage shot from it.

The camera make and model is the IO Industries 2KSDI.
This image was acquired from 
Looking into the specifications section on the official page, I found that the camera shoots in 2048 x 1088 (pixels).

I require the actual sensor's width and height (in cm, mm or inches) however, so I continued reading on the page.

There is only 1 measurement of the sensor, and it is reportedly 12.7mm diagonally. I tried searching for sensor measurements from other sources, like re-sellers and distributors websites, and even forums, to no avail. It seems like nobody needed to know the width and height (besides for camera tracking purposes).

I remembered from trigonometry back in school, of being able to calculate the third side of a triangle if two sides are known, or something like that. In my current problem, if we break the sensor into two triangles, the diagonal measurement that is known (12.77mm), can be seen as the longest side of a triangle (the hypotenuse). I know the width and the height of the sensor as a ratio, from the number of pixels stated in the camera specifications, even though I do not know the exact measurements.

So I had to get in touch with my secondary school mathematics again, enlisting the help of the mighty Pythagoras Theorem.

I found an awesome and easy-to-understand website that explains the Pythagoras Theorem in simple English (with diagrams too!) Aptly named, the website is www.MathsIsFun.com. :)

From the www.MathsIsFun.com page, I found out that if a triangle is a right-angle triangle (one corner of the triangle is 90 degrees), we can use the formula a^2 + b^2 = c^2. (^2 stands for to the power of 2, or the number squared). c would have to be the hypotenuse, which is the longest side of the triangle.

Substituting the numbers with the sensor size in number of pixels, for a and b, our formula would look like this:
w^2 + h^2 = c^2
(I've swapped the width with the height with the original a and b, but it really does not matter since the formula is a simple addition, which means the numbers are commutative, and does not matter which gets evaluated first, between a and b).

substituting w and h with sensor size in number of pixels,
2048^2 + 1088^2 = c^2

going ahead to evaluate c from the above:
4194304 + 1183744 = 5378048

Now, if we find out the square root of 5378048, we would get back the c in our equation. However, the units of measurement in our current formula is in pixels. We have to find a way to tie in our physical measured value of 12.77mm from the original specs sheet.

With the known value of c^2 to be 5378048, now lets go ahead and find out the value of c by doing a square root of 5378048. Hence our formula would be:
2048^2 + 1088^2 = 2319.061879^2

Now, we know that 2319.061879 in units of pixels, is actually 12.77mm in the physical world. Therefore, we now need to find the factor which 2319.061879 can be divided by, to scale all our pixel units into real world measurements in millimeters!

That scale factor would be: 2319.061879 (pixel units) / 12.77 (mm units)
This gives us 181.60233978073609.
This means that dividing 2319.061879 (pixel units) by this new factor (181.60233978073609) will give us 12.77mm, bringing the value from pixel units into the physical world of mm units.

Finally, the width and height of the 2KSDI would be:
Width - 2048 / 181.60233978073609 = 11.277387738906471mm
Height - 1088 / 181.60233978073609  = 5.9911122362940628mm

I am making a lot of assumptions in this method. If the footage that comes in with a 1.667 ratio (16:9, usually 2048 x 1157) instead of the stated sensor ratio in the specs (1.88), I'll have to do some different calculation from there.

I am writing this down to document my thought process..

I hope this helps you in some way.

Thanks for reading. :)


  1. Hi Patrick,
    There is an equivalent, more direct method. We begin the same way:
    w^2 + h^2 = 12.77^2 ... (1)
    From the measurement you have, we know the following:
    w / h = 2048 / 1088
    w = 2048/1088 * h ... (2)
    Substituting (2) into (1), we get:
    (2048/1088 * h)^2 + h^2 = 12.77 ^ 2
    [1 + (2048/1088)^2] * h^2 = 12.77 ^ 2
    h = sqrt(12.77 ^ 2 / [1 + (2048/1088)^2])
    This results in practically the same value for the height in mm: 5.9911122355315394079356787060372

    With that, getting the value of w is easy. Simply substitute the value of h into equation (2) and we are done :)

    The assumption of this method is that the pixels are square. If the pixels are not square, then equation (2) needs to be changed into:
    w = pixel_aspect_ratio * 2048/1088 * h
    We can then follow the next mechanical steps as we did above.

    1. Well done Denny! Truly a mathematical computer science person!
      I love the way you express width in terms of height, so there would be just 1 variable in the equation.

      Creating a provision for the pixel aspect and including that into equation 2 is a truly nice touch.

      I do not fully understand how 2048/1088 * h)^2 turned into [1 + (2048/1088)^2]. Is this some sort of quadratic equation?

      Thanks for enlightening!

    2. (2048/1088 * h)^2 + h^2 turning into [1 + (2048/1088)^2] * h^2 is due to distributive property (http://en.wikipedia.org/wiki/Distributive_property). Distributive property is like this:
      a*m + b*m = (a + b)*m

      To consistent, I should have typed the following:
      (2048/1088 * h)^2 + h^2 = 12.77 ^ 2
      (2048/1088)^2 * h^2 + h^2 = 12.77 ^ 2
      [(2048/1088)^2 + 1] * h^2 = 12.77 ^ 2

      Hope that clarifies.