【问题标题】:Swift 4, Is there a way to capture photo with good quality without using capturePhoto?Swift 4,有没有办法在不使用 capturePhoto 的情况下捕捉高质量的照片?
【发布时间】:2018-10-03 02:55:36
【问题描述】:
我知道 AvcaptureSession.Preset.Photo 的视频输出大小为 750/1000,照片输出大小为 3024 / 4034
有没有办法在不使用 capturePhoto 的情况下捕获照片输出?
我试图从“didoutput”捕获,但这是一个视频输出,所以我得到了 750/1000 的大小。
请帮帮我..
【问题讨论】:
标签:
swift4
avcapturesession
avcapturedevice
avcapture
avcaptureoutput
【解决方案1】:
您可以将 UIImagePickerController 与 sourceType.camera 一起使用。这将打开一个来自苹果的预制相机,您可以使用它拍照。
这将是函数:
func camera() {
if UIImagePickerController.isSourceTypeAvailable(.camera) {
let myCameraController = UIImagePickerController()
myCameraController.delegate = self
myCameraController.sourceType = .camera
self.present(myCameraController, animated: true, completion: nil)
}
}
要使用 UIImagePickerController 你必须在你的类中设置 UIImagePickerControllerDelegate 和 UINavigationControllerDelegate 并在 ViewDidLoad 中调用这个函数
希望这能解决您的问题