# Is there any way to calculate camera focal length and sensor size from a single image?

I know that there are some toolboxes that we can use to calibrate the camera. As I know all of them need some specific types of images including checkerboards with different angles.

But, I have some images and want to calculate camera parameters (e.g. focal length and sensor size) from those images. Any suggestion?

• – p2or
Commented Nov 23, 2016 at 14:43
• Commented Nov 23, 2016 at 16:37

If anyone else is stuck 😁: https://www.blendernation.com/2012/01/23/blam-geometry-camera-matching-add-on/

This add-on calculates the focal length from q couple of lines drawn on the image

• This might be better as a comment Commented Jan 22, 2018 at 16:46

It is not possible to determine both lens and sensor size simultaneously.

It is relatively easy however, to find the value of a lens given an arbitrary sensor size.

Stuffmatic's Blam (now Fspy) addon can match the camera placement based on the perspective of the image using lines drawn with the grease pencil. The add-on will modify the render size of the scene (in pixels) based on the reference image, and will also determine the lens size, based the sensor size for the current scene in blender.

NOTE: Blam is no longer mantained and has been replaced by Fspy: https://fspy.io/, but there is no importer for blender 2.79 or previous versions.

For a detailed post on how to use blam and Fspy read: How can I recreate geometry using a photograph?

Knowing the lens size will help you determine the Field of view in degrees.

The field of view's value is unique for the combination of the length of the lens and the dimensions of the sensor.

For example: you will have the same field of view (roughly 35 degrees) with a 35mm lens on an APSc size sensor, as you would have on a Full Frame sensor with a 50mm lens, or with a 75mm lens on a medium format camera.

You can know the lens field of view in the camera settings for blender, and if you change the sensor size then you can use that information to find the lens equivalent.

Why should we care for the sensor size then?

While the field of view of an image with different lenses and sensor size combinations might be the same, the depth of field will vary depending on the length of the lens.

If your goal is to have a perfect integration between CG images and a photographic image, ideally you would need to match the values with those of the camera and lens used.

After reading all of the above... what is the conclusion?

Sadly, that while it is easy to find the field of view of an image, there are no tools to determine the size of the original sensor size, other than an educated guess based on experience (like the light conditions, estimated depth of field, etc) or other external information (like the Exif data on the file, or historical records, or hearsay).

As you can guess, those who make special effects for photographs and movies make all kinds of notes on the field to know the conditions in which images are made, so that they don't have to guess any of it when integrating images with CG.