简体   繁体   English

GPhoto2 - 直接从相机获取焦距和传感器尺寸

[英]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?是否可以使用 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.我也知道我可以使用 config.js 获取/设置一些参数(速度、光圈等)。 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.我需要以像素为单位知道焦距,我打算根据焦距、传感器尺寸和图像分辨率来计算它。

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.我可以建议的唯一解决方案是拍照,从相机复制它(或者甚至只是复制前几个 KB),然后从照片的 Exif 数据中获取您想要的信息。

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.在我的 T3i 上, size产生传感器分辨率:5184x3456。 You can just parse this string with awk/sed/perl/etc.. to get just the resolution.您可以使用 awk/sed/perl/etc.. 解析此字符串以获取分辨率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM