elena
elena

Reputation: 111

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

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.

Upvotes: 0

Views: 882

Answers (2)

insaner
insaner

Reputation: 1705

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.

Upvotes: 0

Jim Easterbrook
Jim Easterbrook

Reputation: 154

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.

Upvotes: 1

Related Questions