1
카메라 응용 프로그램을 구현 중입니다. 다음과 같이 카메라를 시작합니다.AVCaptureVideoPreviewLayer에서 실시간 확대
let input = try AVCaptureDeviceInput(device: captureDevice!)
captureSession = AVCaptureSession()
captureSession?.addInput(input)
videoPreviewLayer = AVCaptureVideoPreviewLayer(session: captureSession!)
videoPreviewLayer?.videoGravity = AVLayerVideoGravity.resizeAspectFill
videoPreviewLayer?.frame = view.layer.bounds
previewView.layer.insertSublayer(videoPreviewLayer!, at: 0)
이제 미리보기 레이어 위에 작은 직사각형을 찍고 싶습니다. 그 사각형 영역에서 미리보기 레이어에서 특정 영역을 확대하고 싶습니다. 이를 수행하기 위해 다른보기 위에 새로운 UIView를 추가했지만 미리보기에서 특정 영역을 표시하는 방법을 모르겠습니다 (예 : 확대/축소 비율 = 2). 다음 그림은 갖고 싶은 것을 보여줍니다 : 어떻게해야합니까?