Thursday, October 12, 2023
HomeiOS Developmentios - AVFoundation's ultra-wide-angle digital camera behaves in another way than the...

ios – AVFoundation’s ultra-wide-angle digital camera behaves in another way than the default apple digital camera


Thanks for studying.

I’m making a customized digital camera utilizing AVFoundation.

Once I maximize the broad angle with the extremely broad angle digital camera (when videoZoomFactor is minimized), the broad angle discipline of view is narrower in comparison with the apple default digital camera.

Wanting on the metadata from the album, the focal size is 13mm for the apple default digital camera, whereas it’s 16mm for the one I created. Under is an excerpt of the code.

Digicam Settings

if let captureDevice = AVCaptureDevice.default(
      .builtInTripleCamera,
      for: .video,
      place: .again
    ) {
      self.captureDevice = captureDevice
    } else if let captureDevice = AVCaptureDevice.default(
      .builtInDualWideCamera,
      for: .video,
      place: .again
    ) {
      self.captureDevice = captureDevice
    } else if let captureDevice = AVCaptureDevice.default(
      .builtInWideAngleCamera,
      for: .video,
      place: .again
    ) {
      self.captureDevice = captureDevice
}
do {
      let enter = strive AVCaptureDeviceInput(machine: captureDevice)
      let videoDataOutput = AVCaptureVideoDataOutput()
      // Omitted

      photoOutput = AVCapturePhotoOutput()
      guard let photoOutput = photoOutput else { return }
      photoOutput.isHighResolutionCaptureEnabled = true

      session.sessionPreset = .picture

     // Omitted
    } catch {
      
}
for connection in session.connections {
      connection.preferredVideoStabilizationMode = .cinematicExtended
}

zoom operate

   func zoom(zoomFactor: CGFloat, ramping: Bool = false) {
    do {
      strive captureDevice?.lockForConfiguration()
      self.zoomFactor = zoomFactor
      if ramping {
        captureDevice?.ramp(toVideoZoomFactor: zoomFactor, withRate: 10.0)
      } else {
        captureDevice?.videoZoomFactor = zoomFactor
      }
      captureDevice?.unlockForConfiguration()
    } catch {
      errorReportingService.reportError(error: error)
    }
  }

Check gadgets: iPhone 11, 12mini

Thanks for studying this far. I wish to make it as broad angle because the apple default digital camera!

This app permits for a wider angle than the one I created. So I consider there’s a approach.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments