Slide 1

Slide 1 text

Slide 2

Slide 2 text

Slide 3

Slide 3 text

Slide 4

Slide 4 text

Slide 5

Slide 5 text

Slide 6

Slide 6 text

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

 ➓

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

AVCaptureDeviceDiscoverySession let discoverySession = AVCaptureDeviceDiscoverySession( deviceTypes: [.builtInDuoCamera], mediaType: AVMediaTypeVideo, position: .back) let devices: [AVCaptureDevice]? = discoverySession?.devices

Slide 13

Slide 13 text

AVCaptureDeviceType .builtInWideAngleCamera .builtInTelephotoCamera .builtInDuoCamera

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

.builtInDuoCamera

Slide 17

Slide 17 text

.builtInTelephotoCamera .builtInTelephotoCamera let captureSession = AVCaptureSession() captureSession.addInput(wideAngleCameraDevice) captureSession.addInput(telephotoCameraDevice)

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

AVCaptureStillImageOutput AVCapturePhotoOutput

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

UIImagePickerController AVFoundation AVCapturePhotoOutput

Slide 25

Slide 25 text

AVCapturePhotoOutput let types = photoOutput.availableRawPhotoPixelFormatTypes let type = types.first!.uint32Value let settings = AVCapturePhotoSettings(rawPixelFormatType: type) photoOutput.capturePhoto(with: settings, delegate: self)

Slide 26

Slide 26 text

AVCapturePhotoCaptureDelegate rawSampleBuffer: CMSampleBuffer? func capture(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingRawPhotoSampleBuffer rawSampleBuffer: CMSampleBu previewPhotoSampleBuffer: CMSampleBuffer?, resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Error?) { }

Slide 27

Slide 27 text

CVPixelBuffer “rgg4” kCVPixelFormatType_14Bayer_RGGB // CVPixelBuffer? let pixelBuffer = CMSampleBufferGetImageBuffer(rawSampleBuffer!)

Slide 28

Slide 28 text

// Data? let data = AVCapturePhotoOutput.dngPhotoDataRepresentation( forRawSampleBuffer: rawSampleBuffer!, previewPhotoSampleBuffer: previewPhotoSampleBuffer)

Slide 29

Slide 29 text

import CoreImage.framework CIFilter CIFilter CIImage let rawFilter = CIFilter(imageURL: rawURL, options: nil) // Noise Reduction let nrKey = kCIInputLuminanceNoiseReductionAmountKey if let nr = rawFilter?.value(forKey: nrKey) { rawFilter.setValue(nr.doubleValue + 0.1, forKey: nrKey) } let image: CIImage? = rawFilter?.outputImage // ‐> CGImage, UIImage, JPEG, ...

Slide 30

Slide 30 text