• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PhotoCamera类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PhotoCamera的典型用法代码示例。如果您正苦于以下问题:C# PhotoCamera类的具体用法?C# PhotoCamera怎么用?C# PhotoCamera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PhotoCamera类属于命名空间,在下文中一共展示了PhotoCamera类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            //Networking.DeleteFile("CurrentGame");
            //Networking.DeleteFile("Players");

            //Check if a game in progress has already been saved and continue it
            string data = Networking.LoadData("CurrentGame");
            if (data != "" && MessageBox.Show("Would you like to resume the game with id of " + data, "Continue Game", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                NavigationService.Navigate(new Uri("/GamePage.xaml?gameid=" + data, UriKind.Relative));
            else
            {
                _timer = new DispatcherTimer();
                _timer.Interval = TimeSpan.FromMilliseconds(250);
                _timer.Tick += (o, arg) => ScanPreviewBuffer();
                //The timer auto-starts so it needs to be stopped here
                _timer.Stop();
            }

            //Login to the server
            Networking.Login();

            _cam = new PhotoCamera();

            _cam.Initialized += cam_Initialized;

            video.Fill = _videoBrush;
            _videoBrush.SetSource(_cam);
            _videoBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
        }
开发者ID:tcd-tophat,项目名称:WP7-QRzar,代码行数:31,代码来源:MainPage.xaml.cs


示例2: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (_photoCamera == null){
                _photoCamera = new PhotoCamera();
                _photoCamera.Initialized += OnPhotoCameraInitialized;
                _previewVideo.SetSource(_photoCamera);

                CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
            }

            if (timer == null){
                timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
                timer.Tick += (o, arg) => ScanPreviewBuffer();
            }

            if (scanEffect == null){

                var resourceStream = Application.GetResourceStream(new System.Uri("Plugins/com.phonegap.plugins.barcodescanner/beep.wav", UriKind.Relative));
                if (resourceStream != null)
                {
                    scanEffect = SoundEffect.FromStream(resourceStream.Stream);
                }
            }

            timer.Start();
        }
开发者ID:rvdkley,项目名称:BarcodeScanner,代码行数:28,代码来源:Scanner.xaml.cs


示例3: OnNavigatedTo

      protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
      {
         base.OnNavigatedTo(e);

         // Delayed due to Camera init bug in WP71 SDK Beta 2
         // See http://forums.create.msdn.com/forums/p/85830/516843.aspx
         Dispatcher.BeginInvoke(() =>
                                {

                                   // Initialize the webcam
                                   photoCamera = new PhotoCamera();
                                   photoCamera.Initialized += PhotoCameraInitialized;
                                   CameraButtons.ShutterKeyHalfPressed += PhotoCameraButtonHalfPress;
                                   isInitialized = false;
                                   isDetecting = false;

                                   // Fill the Viewport Rectangle with the VideoBrush
                                   var vidBrush = new VideoBrush();
                                   vidBrush.SetSource(photoCamera);
                                   Viewport.Fill = vidBrush;

                                   // Start timer
                                   dispatcherTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(50)};
                                   dispatcherTimer.Tick += (sender, e1) => Detect();
                                   dispatcherTimer.Start();
                                });
      }
开发者ID:amoldeshpande,项目名称:slartoolkit,代码行数:27,代码来源:MainPage.xaml.cs


示例4: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _isCameraInitialized = false;
            _isTrial = new IsTrialQuery().Get();

            if (_isTrial)
            {
                var menuItem = new ApplicationBarMenuItem("Buy full version");
                menuItem.Click += (sender, args) => Deployment.Current.Dispatcher.BeginInvoke(() => new MarketplaceDetailTask().Show());
                ApplicationBar.MenuItems.Add(menuItem);
            }

            OnOrientationChanged(this, new OrientationChangedEventArgs(Orientation));

            if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
            {
                _pixelator = new Pixelator(new PixelationSizeQuery().Get(), true);

                _photoCamera = new PhotoCamera(CameraType.Primary);
                _photoCamera.Initialized += OnCameraInitialized;
                _photoCamera.CaptureImageAvailable += OnCameraCaptureImageAvailable;
                _photoCamera.CaptureCompleted += OnCameraCaptureCompleted;
                _photoCamera.CaptureStarted += OnCameraCaptureStarted;

                ViewfinderBrush.SetSource(_photoCamera);
            }
            else
            {
                // TODO: handle possibility of no camera
            }
        }
开发者ID:petermorlion,项目名称:EightBitCamera,代码行数:31,代码来源:MainPage.xaml.cs


示例5: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (Microsoft.Devices.Environment.DeviceType == Microsoft.Devices.DeviceType.Emulator)
            {
                MessageBox.Show("You must deploy this sample to a device, instead of the emulator so that you can get a video stream including a barcode/QR code");
                this.IsEnabled = false;
                base.NavigationService.GoBack();
            }
            else
            {
                string type = "";
                if (NavigationContext.QueryString.TryGetValue("type", out type) && type == "qrcode")
                {
                    _reader = new QRCodeReader();
                }
                else
                {
                    _reader = new EAN13Reader();
                }

                _photoCamera = new PhotoCamera();
                _photoCamera.Initialized += new EventHandler<CameraOperationCompletedEventArgs>(cam_Initialized);
                _videoBrush.SetSource(_photoCamera);
                BarCodeRectInitial();
                base.OnNavigatedTo(e);
            }
        }
开发者ID:jevonsflash,项目名称:Healthcare,代码行数:27,代码来源:BarCode.xaml.cs


示例6: SetCamera

 public void SetCamera()
 {
     _photoCamera = new PhotoCamera(CameraType.Primary);
     cameraViewFinder.SetSource(_photoCamera);
     double cameraRotation = _photoCamera.Orientation;
     previewTransform.Rotation = _photoCamera.Orientation + 0;
 }
开发者ID:vapps,项目名称:sqrcam,代码行数:7,代码来源:CameraPage.xaml.cs


示例7: OnNavigatedTo

 //Code for initialization, capture completed, image availability events; also setting the source for the viewfinder.
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     // Check to see if the camera is available on the phone.
     if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
          (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
     {
         // Initialize the camera, when available.
         if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
         {
             // Use front-facing camera if available.
             cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
         }
         else
         {
             // Otherwise, use standard camera on back of phone.
             cam = new Microsoft.Devices.PhotoCamera(CameraType.FrontFacing);
         }
         // Event is fired when the capture sequence is complete and an image is available.
         cam.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(cam_CaptureImageAvailable);
         //Set the VideoBrush source to the camera.
         viewfinderBrush.SetSource(cam);
         viewfinderBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };
     }
     else
     {
         // The camera is not supported on the phone.
         this.Dispatcher.BeginInvoke(delegate()
         {
             // Write message.
             txtDebug.Text = "A Camera is not available on this phone.";
         });
         // Disable UI.
         ShutterButton.IsEnabled = false;
     }
 }
开发者ID:neovasolutions,项目名称:MSTeam_SmartParkingSystem_Phase3,代码行数:36,代码来源:BarcodeScanner.xaml.cs


示例8: OnNavigatedTo

        // Load data for the ViewModel Items
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            // Initialize the camera object
            _phoneCamera = new PhotoCamera();
            _phoneCamera.Initialized += cam_Initialized;
            _phoneCamera.AutoFocusCompleted += _phoneCamera_AutoFocusCompleted;

            CameraButtons.ShutterKeyHalfPressed += CameraButtons_ShutterKeyHalfPressed;

            //Display the camera feed in the UI
            viewfinderBrush.SetSource(_phoneCamera);


            // This timer will be used to scan the camera buffer every 250ms and scan for any barcodes
            _scanTimer = new DispatcherTimer();
            _scanTimer.Interval = TimeSpan.FromMilliseconds(250);
            _scanTimer.Tick += (o, arg) => ScanForBarcode();

            viewfinderCanvas.Tap += new EventHandler<GestureEventArgs>(focus_Tapped);

            base.OnNavigatedTo(e);
        }
开发者ID:wesee,项目名称:RideNow,代码行数:28,代码来源:MainPage.xaml.cs


示例9: BarcodeScanningView

        /// <summary>
        /// Initializes a new instance of the BarcodeScanningView class.
        /// </summary>
        public BarcodeScanningView()
        {
            InitializeComponent();

            _scannerWorker = new BackgroundWorker();
            _scannerWorker.DoWork += scannerWorker_DoWork;
            _scannerWorker.RunWorkerCompleted += scannerWorker_RunWorkerCompleted;

            Loaded += (sender, args) =>
                          {
                              if (_photoCamera == null)
                              {
                                  _photoCamera = new PhotoCamera();
                                  _photoCamera.Initialized += OnPhotoCameraInitialized;
                                  previewVideo.SetSource(_photoCamera);

                                  CameraButtons.ShutterKeyHalfPressed += (o, arg) => FocusTheCamera();
                              }

                              if (_timer == null)
                              {
                                  _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
                                  _timer.Tick +=TimerOnTick;
                              }

                              if (_focusTimer == null)
                              {
                                  _focusTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(4500) };
                                  _focusTimer.Tick += (o, eventArgs) => FocusTheCamera();
                              }

                              _timer.Start();
                          };
        }
开发者ID:ntomlinson,项目名称:StoreCardBuddy,代码行数:37,代码来源:BarcodeScanningView.xaml.cs


示例10: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true)
            {
                camera = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
                photoViewfinderVideoBrush.SetSource(camera);

                photoViewfinderVideoBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 90 };

                camera.CaptureCompleted += new EventHandler<CameraOperationCompletedEventArgs>(captureCompletedHandler);
                camera.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(captureImageAvailableHandler);
                camera.CaptureThumbnailAvailable += new EventHandler<ContentReadyEventArgs>(captureThumbnailAvailableHandler);
                camera.AutoFocusCompleted += new EventHandler<CameraOperationCompletedEventArgs>(autoFocusCompletedHandler);

                CameraButtons.ShutterKeyHalfPressed += onButtonHalfPressHandler;
                CameraButtons.ShutterKeyPressed += onButtonFullPressHandler;
                CameraButtons.ShutterKeyReleased += onButtonReleaseHandler;

            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(delegate()
                 {
                     MessageBox.Show("Camera not supported in this phone");
                 });

                NavigationService.GoBack();
            }
        }
开发者ID:henrikuu,项目名称:CSReportApp,代码行数:29,代码来源:PhotoCapturePage.xaml.cs


示例11: cam_Initialized

        private void cam_Initialized(object sender, CameraOperationCompletedEventArgs e)
        {
            if (!e.Succeeded)
            {
                cam = null;
                return;
            }

            try
            {
                cam = (PhotoCamera)sender;
                cam.Resolution = cam.AvailableResolutions.First();
            }
            catch (Exception)
            {
                cam = null;
                return;
            }

            this.Dispatcher.BeginInvoke(delegate()
            {
                if (cam == null)
                    return;

                WriteableBitmap bitmap = new WriteableBitmap((int)cam.PreviewResolution.Width,
                                                             (int)cam.PreviewResolution.Height);
                frameStart = DateTime.Now;
                cam.GetPreviewBufferArgb32(bitmap.Pixels);
                detectFaces(bitmap);
            });
        }
开发者ID:viperium,项目名称:WatchDogWP8,代码行数:31,代码来源:CalibrationScreen.xaml.cs


示例12: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
             (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
            {
                if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing))
                {
                    cam = new Microsoft.Devices.PhotoCamera(CameraType.FrontFacing);
                }
                else
                {
                    cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
                }

                viewfinderBrush.SetSource(cam);
                cam.Initialized += cam_Initialized;
                cam.CaptureCompleted += cam_CaptureCompleted;
                cam.CaptureImageAvailable += cam_CaptureImageAvailable;
                cam.AutoFocusCompleted += cam_AutoFocusCompleted;

                // 当按下快门按钮并保持大约 800 毫秒时。短于该时间的半按压将不会触发该事件。
                CameraButtons.ShutterKeyHalfPressed += OnButtonHalfPress;
                // 当快门按钮收到一个完全按压时。
                CameraButtons.ShutterKeyPressed += OnButtonFullPress;
                // 当松开快门按钮时。
                CameraButtons.ShutterKeyReleased += OnButtonRelease;
            }

            base.OnNavigatedTo(e);
        }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:30,代码来源:MainPage.xaml.cs


示例13: GetBitmapFromVideo

        //takes the video input and creates a bitmap of the image
        BinaryBitmap GetBitmapFromVideo(PhotoCamera cam)
        {
            BinaryBitmap binaryBitmap = null;

            try
            {
                // Update buffer size    
                var pixelWidth = (int)_cam.PreviewResolution.Width;
                var pixelHeight = (int)_cam.PreviewResolution.Height;

                if (_buffer == null || _buffer.Length != (pixelWidth * pixelHeight))
                {
                    _buffer = new byte[pixelWidth * pixelHeight];
                }

                _cam.GetPreviewBufferY(_buffer);

                var luminance = new RGBLuminanceSource(_buffer, pixelWidth, pixelHeight, true);
                var binarizer = new com.google.zxing.common.HybridBinarizer(luminance);

                binaryBitmap = new BinaryBitmap(binarizer);
            }
            catch
            {
            }

            return binaryBitmap;
        }
开发者ID:g-jackson,项目名称:WP7-QRzar,代码行数:29,代码来源:BarCode.xaml.cs


示例14: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _photoCamera = new PhotoCamera();
              _photoCamera.Initialized += OnPhotoCameraInitialized;
              _previewVideo.SetSource(_photoCamera);

              base.OnNavigatedTo(e);
        }
开发者ID:TheFerrango,项目名称:aMUSE_WP7,代码行数:8,代码来源:ScanQRCode.xaml.cs


示例15: InitCamera

		private void InitCamera()
		{
			_camera = new PhotoCamera(CameraType.Primary);
			_camera.Initialized += _camera_Initialized;

			VideoViewfinderBrush.SetSource(_camera);
			VideoViewfinderTransform.Rotation = _camera.Orientation;
		}
开发者ID:romeowa,项目名称:pisa,代码行数:8,代码来源:CameraControl.xaml.cs


示例16: camera

 public camera()
 {
     InitializeComponent();
     mediaLib = new MediaLibrary();
     myCam = new PhotoCamera(CameraType.Primary);
     myCam.CaptureCompleted += new EventHandler<CameraOperationCompletedEventArgs>(captureCompleted);
     myCam.CaptureImageAvailable += new EventHandler<ContentReadyEventArgs>(captureImageAvailable);
     viewfinderBrush.SetSource(myCam);
 }
开发者ID:jaydeep17,项目名称:TheReader,代码行数:9,代码来源:camera.xaml.cs


示例17: OnNavigatedTo

 // Code for initialization and setting the source for the viewfinder
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     camera = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
     // Event is fired when PhotoCamera object has beeninitialized.
     camera.Initialized += new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(cam_Initialized);
     camera.AutoFocusCompleted += new EventHandler<CameraOperationCompletedEventArgs>(cam_AutoFocusCompleted);
     //Set the VideoBrush source to the video
     mainCameraBrush.SetSource(camera);
 }
开发者ID:gibratim,项目名称:pdis,代码行数:10,代码来源:detect.xaml.cs


示例18: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _photoCamera = new PhotoCamera();
            _photoCamera.Initialized += OnPhotoCameraInitialized;
            _previewVideo.SetSource(_photoCamera); // _previewVideo is a VideoBrush-object

            CameraButtons.ShutterKeyHalfPressed += (o, arg) => _photoCamera.Focus();

            base.OnNavigatedTo(e);
        }
开发者ID:TWEagle,项目名称:WINDOWSPHONE8,代码行数:10,代码来源:ScannerPage.xaml.cs


示例19: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            photoCamera = new PhotoCamera();
            previewVideo.SetSource(photoCamera);
            photoCamera.Initialized += OnPhotoCameraInitialized;

            CameraButtons.ShutterKeyHalfPressed += (o, arg) => photoCamera.Focus();

            base.OnNavigatedTo(e);
        }
开发者ID:rmusina,项目名称:rebus,代码行数:10,代码来源:ReBusPivotMenu.xaml.cs


示例20: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            camera = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
            camera.Initialized += new EventHandler<CameraOperationCompletedEventArgs>(camera_Initialized);
            camera.AutoFocusCompleted += new EventHandler<CameraOperationCompletedEventArgs>(camera_AutoFocusCompleted);
            previewVideo.SetSource(camera);

            // Prevent screen lock
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
        }
开发者ID:dannysu,项目名称:flashlight-mango,代码行数:10,代码来源:MainPage.xaml.cs



注:本文中的PhotoCamera类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PhotoChooserTask类代码示例发布时间:2022-05-24
下一篇:
C# Photo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap