GPhoto2 - get focal length and sensor size directly from the camera

750 Views Asked by At

Is it possible to get focal length and/or sensor size directly from the camera using GPhoto2?

I've tried to look for it in camera object and in file info, but to no avail. I also know I can get/set some parameters (speed, aperture and so on) using config. Focal length is not one of them for obvious reasons, but I was wondering if camera knows its current value. Same for the sensor size, of course it's not configurable, but I assume camera would know it internally.

Why do I need this? I need to know focal length in pixels and I intend to compute it from focal length, sensor size and image resolution.

2

There are 2 best solutions below

6
On BEST ANSWER

The camera config can include read-only parameters, which might include focal length for some cameras. (The whole config is very camera dependent.)

The only solution I can suggest is to take a photo, copy it from the camera (or even just copy the first few kilobytes) then get the info you want from the photo's Exif data.

0
On

Do you perhaps mean this?

$ gphoto2 --get-config focusinfo
Label: Focus Info                                                              
Readonly: 0
Type: TEXT
Current: eosversion=4,size=5184x3456,size2=5184x3456,points={{-1477,0,186,139},{-886,418,186,139},{-886,-418,186,139},{0,787,127,196},{0,0,231,238},{0,-787,127,196},{886,418,186,139},{886,-418,186,139},{1477,0,186,139}},select={},unknown={ff010000ffff}
END

on my T3i, size yields the sensor resolution: 5184x3456. You can just parse this string with awk/sed/perl/etc.. to get just the resolution.