[英]How to avoid blocking the UI when using the iPhone camera via AVFoundation?
[英]how to get focal length of camera of iPhone using AVFoundation
如何找到 iPhone 相機鏡頭的焦距。 我已經通過這個找到了鏡頭光圈值:- let aperture = currentcamera?.lensAperture
print("Aperture of camera is:-",aperture!)
為此,您需要首先從相機中獲取圖像,然后從返回的 Exif 數據中讀取其焦距屬性。 示例代碼在這里給出並復制如下以供參考:
// 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)")
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.