如何找到iPhone相机镜头的焦距。我已经通过以下方法找出了镜头光圈值:let aperture = currentcamera?.lensAperture
print("Aperture of camera is:-",aperture!)
为此,您首先需要从相机拍摄图像,然后从返回的Exif数据中读取其焦距属性。给出了示例代码here,并在下面复制以供参考:
// delegate method for the image picker
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let metadata = info[UIImagePickerControllerMediaMetadata] as? NSDictionary
let exifdata = metadata!["{Exif}"] as! NSDictionary
// focal length
let focalLength = exifdata["FocalLength"] as! Double
print("Focal length \(focalLength)")
}