0

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.

elena
  • 91
  • 2
  • 12

2 Answers2

1

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.

  • we've looked at the exif, unfortunatelly it doesn't have this information, that's why I was trying to get it using gphoto. – elena Dec 19 '19 at 11:20
  • i have printed the whole config and this information is not there - it means it's not there then, right? – elena Dec 19 '19 at 11:21
  • Yes, if it's not in the config then it's not there. I'm surprised it's not in photo's Exif, but this is also camera dependent. My Canon SLR definitely has focal length and sensor resolution. – Jim Easterbrook Dec 19 '19 at 12:13
  • yes, sensor resolution, but not physical sensor size – elena Dec 19 '19 at 12:15
  • It's unfortunate, but thank you for the quick replies. – elena Dec 19 '19 at 12:19
  • I calculate sensor size from image size (in pixels) and Exif.Image.FocalPlane{X,Y}Resolution. https://www.exiv2.org/tags.html – Jim Easterbrook Dec 19 '19 at 12:26
0

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.

insaner
  • 1,641
  • 16
  • 28