2017-11-15 2 views
1

안녕하세요 애플리케이션의 최대 확대/축소 수준으로 카메라의 확대를 시도하고 있습니다.Xamarin - AVCapture의 확대/축소 설정이 작동하지 않습니다.

그러나 AvCapture를 최대 값으로 설정하면 화면에서 가장 낮은 줌 레벨로 유지됩니다. 아래는 제 코드입니다.

void Initialize() 
{ 

var videoDevices = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video); 
var cameraPosition = (cameraOptions == CameraOptions.Front) ? AVCaptureDevicePosition.Front : AVCaptureDevicePosition.Back; 
var device = videoDevices.FirstOrDefault(d => d.Position == cameraPosition);    

device.LockForConfiguration(out error); 
if (error == null) 
{ 
    Console.WriteLine("Supports Preset"); 
    var test = device.RampingVideoZoom; 
    var d = device.VideoZoomFactor; 
    device.VideoZoomFactor = device.ActiveFormat.VideoMaxZoomFactor; 
} 
device.UnlockForConfiguration(); 

while(device.RampingVideoZoom == true) 
{ 
    Console.WriteLine("Zooming camera"); //This line is never written 
} 

//See below for value this returns in Console 
Console.WriteLine("Current Format"); 
Console.WriteLine(device.ActiveFormat); 

} 

현재 형식

<AVCaptureDeviceFormat: 0x1c48049a0 'vide'/'420v' 1920x1080, { 3- 30 fps}, HRSI:4096x2304, fov:59.680, supports vis, max zoom:16.00 (upscales @1.94), AF System:2, ISO:22.0-704.0, SS:0.000005-0.333333> 

이 코드는 AT ALL 카메라의 줌에 영향을주지 않습니다.

내가 뭘 잘못하고 있니?

답변

1

videoMaxZoomFactor Definition

1.0 최대 요인은 포맷 확대 할 수없는 것을 나타낸다.

코드에 실수가 없습니다.

문서에 따르면 device.ActiveFormat.VideoMaxZoomFactor == 1 인 경우 확대/축소 기능을 사용할 수 없습니다.

당신은 "현재 형식"아래 줄에 보면은 그래서 1

+0

에 euqals 있는지 device.ActiveFormat.VideoMaxZoomFactor의 값을 디버깅 할 수는 장치'의 값이 무엇 16 – RyeGuy

+0

의 최대 줌 배율을 가지고 .ActiveFormat.VideoMaxZoomFactor' –

관련 문제