private void Initialize()
        {
            //Pinchジェスチャ登録
            SetPinchGesture();

            //デバイス設定
            var videoDevices   = AVCaptureDevice.DevicesWithMediaType(AVMediaType.Video);
            var cameraPosition = (cameraOptions == CameraOptions.Front) ? AVCaptureDevicePosition.Front : AVCaptureDevicePosition.Back;

            MainDevice = videoDevices.FirstOrDefault(d => d.Position == cameraPosition);

            NSError device_error;

            MainDevice.LockForConfiguration(out device_error);
            if (device_error != null)
            {
                Console.WriteLine($"Error: {device_error.LocalizedDescription}");
                MainDevice.UnlockForConfiguration();
                return;
            }
            //フレームレート設定
            MainDevice.ActiveVideoMinFrameDuration = new CMTime(1, 24);
            MainDevice.UnlockForConfiguration();

            if (MainDevice == null)
            {
                return;
            }

            //max zoom
            MaxZoom = (float)Math.Min(MainDevice.ActiveFormat.VideoMaxZoomFactor, 6);

            //入力設定
            NSError error;

            Input = new AVCaptureDeviceInput(MainDevice, out error);
            CaptureSession.AddInput(Input);

            //出力設定
            Output = new AVCaptureVideoDataOutput();

            //フレーム処理用
            Queue = new DispatchQueue("myQueue");
            Output.AlwaysDiscardsLateVideoFrames = true;
            Recorder = new OutputRecorder()
            {
                Camera = Camera
            };
            Output.SetSampleBufferDelegate(Recorder, Queue);
            var vSettings = new AVVideoSettingsUncompressed();

            vSettings.PixelFormatType = CVPixelFormatType.CV32BGRA;
            Output.WeakVideoSettings  = vSettings.Dictionary;

            CaptureSession.AddOutput(Output);

            if (IsPreviewing)
            {
                CaptureSession.StartRunning();
            }
        }