AVFoundation 카메라의 줌 기능으로 작업하고 있습니다. AVCaptureVideoPreviewLayer가있는 뷰의 크기를 조정하여 줌 기능을 구현했습니다. 이제 확대 된 이미지를 캡처하고 싶습니다.AVFoundation에서 확대 된 미리보기 뷰 캡쳐
// zoom the preview view using core graphics
[previewView setTransform:CGAffineTransformMakeScale(2.0, 2.0)];
지금 내가 previewView에서 사전에
덕분에이 확대 된 이미지를 캡처 할
// create a uiview subclass for showing the camera feed
UIView *previewView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 430)];
[[self view] addSubview:previewView];
CGRect layerRect = CGRectMake(0, 0, 320, 430);
[[self avCaptureVideoPreviewLayer] setBounds:layerRect];
[[self previewLayer] setPosition:CGPointMake(CGRectGetMidX(layerRect), CGRectGetMidY(layerRect))];
// add the video previewview layer to the preview view
[[previewView layer] addSublayer:[self avCaptureVideoPreviewLayer]];
코드 미리보기를 확대하기위한 : 여기
은보기에 AVFoundationVideoPreviewLayer를 추가하는 내 코드입니다 .
다른 어떤 더 나은 솔루션이 있습니까? – kadungon
충돌과 관련하여 : 먼저 메모리 문제를 해결하기 위해 크기 조정보다 자르기 만하면됩니다. 대부분의 이미지를 나중에 삭제하면 큰 이미지를 계산하지 마십시오. – CipherCom
나는 당신에게 코드를 시도했지만 cameraZoom을 이해할 수 없었고 결과는 항상 빈 이미지였다. 더 공유 할 수 있습니까? –