Exemple #1
0
 private void _checkEditEnableAe_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (!_isInit)
         {
             bool aeState = _checkBoxEnableAE.Checked;
             if (XCamera.GetInstance().SetAeState(aeState))
             {
                 XCameraAePara aePara;
                 if (XCamera.GetInstance().GetAePara(out aePara))
                 {
                     UpdateControlsByAePara(aePara);
                     InitExpTargetAndGainCtrls(aePara);
                     ulong minExpTime = aePara.ExposureTimeParaRange.MinValue / 10000; //将单位转换为ms
                     ulong maxExpTime = aePara.ExposureTimeParaRange.MaxValue / 10000; //将单位转换为ms
                     ulong curExpTime = aePara.CurExposureTime / 10000;                //将单位转换为ms
                     InitExpTimeCtrls(minExpTime, maxExpTime, curExpTime);
                     InitAntiFlickCtrls();
                     InitFrameSpeedCtrls();
                     InitResolutionCombo();
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
Exemple #2
0
 private void InitResolutionCombo()
 {
     try
     {
         _comboBoxEditResolution.Properties.Items.Clear();
         comboBoxEditCaptureRes.Properties.Items.Clear();
         List <string> resolutionDescription;
         if (XCamera.GetInstance().GetResolutionDescriptionList(out resolutionDescription))
         {
             _comboBoxEditResolution.Properties.Items.AddRange(resolutionDescription.ToArray());
             comboBoxEditCaptureRes.Properties.Items.AddRange(resolutionDescription.ToArray());
         }
         int sel = -1;
         if (XCamera.GetInstance().GetPreviewSizeSel(out sel))
         {
             _comboBoxEditResolution.SelectedIndex = sel;
         }
         if (XCamera.GetInstance().GetCaptureSizeSel(out sel))
         {
             comboBoxEditCaptureRes.SelectedIndex = sel;
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
Exemple #3
0
        private void ZoomWindow(double factor, bool fitScreen = false)
        {
            int workAreaWidth = this.ClientRectangle.Width;
            int workAreaHeight = this.ClientRectangle.Height;
            int previewWidth, previewHeight;

            if (!XCamera.GetInstance().GetPreviewSize(out previewWidth, out previewHeight))
            {
                return;
            }
            Size realSize = new Size(previewWidth, previewHeight);

            if (fitScreen)
            {
                double widthFactor  = Convert.ToDouble(workAreaWidth) / Convert.ToDouble(realSize.Width);
                double heightFactor = Convert.ToDouble(workAreaHeight) / Convert.ToDouble(realSize.Height);
                factor = Math.Min(widthFactor, heightFactor);
            }
            else
            {
                factor = _funcLimitedZoom(factor);
            }
            //_zoomFactor = factor;
            _imageBox.ZoomFactor = factor;
            _imageBox.Width      = Convert.ToInt32(realSize.Width * factor);
            _imageBox.Height     = Convert.ToInt32(realSize.Height * factor);
            _imageBox.Left       = (workAreaWidth > _imageBox.Width) ? (workAreaWidth - _imageBox.Width) / 2 : 0;
            _imageBox.Top        = (workAreaHeight > _imageBox.Height) ? (workAreaHeight - _imageBox.Height) / 2 : 0;
            XCamera.GetInstance().SetDisplaySize(_imageBox.Width, _imageBox.Height);

            SyncImageBack();
        }
Exemple #4
0
 private void InitAntiFlickCtrls()
 {
     try
     {
         bool isAntiFlick = false;
         XCamera.GetInstance().GetAntiFlickState(out isAntiFlick);
         if (isAntiFlick)
         {
             emDSLightFrequency frequency;
             XCamera.GetInstance().GetLightFrequency(out frequency);
             if (frequency == emDSLightFrequency.LIGHT_FREQUENCY_50HZ)
             {
                 _radioGroupAntiFlick.SelectedIndex = 1;
             }
             else
             {
                 _radioGroupAntiFlick.SelectedIndex = 2;
             }
         }
         else
         {
             _radioGroupAntiFlick.SelectedIndex = 0;
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
Exemple #5
0
        private void InitFrameSpeedCtrls()
        {
            try
            {
                emDSFrameSpeed frameSpeed;
                XCamera.GetInstance().GetFrameSpeed(out frameSpeed);
                switch (frameSpeed)
                {
                case emDSFrameSpeed.FRAME_SPEED_NORMAL:
                    _radioGroupFrameSpeed.SelectedIndex = 0;
                    break;

                case emDSFrameSpeed.FRAME_SPEED_HIGH:
                    _radioGroupFrameSpeed.SelectedIndex = 1;
                    break;

                case emDSFrameSpeed.FRAME_SPEED_SUPER:
                    _radioGroupFrameSpeed.SelectedIndex = 2;
                    break;

                default:
                    break;
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
Exemple #6
0
        //  Draw helper that actually issues geometry, or defers for later.
        internal bool Draw(ref XCamera Camera, Matrix world, bool asDeferred)
        {
            //  keep a copy of world, because I override it in the DrawDetails
            bool added = false;

            //  each chunk is drawn separately, as it represents a different
            //  shader set-up (world transform, texture, etc).
            foreach (Chunk ch in chunks_)
            {
                if (asDeferred)
                {
                    //  If I'm called back to draw deferred pieces, don't draw if this
                    //  piece is not deferred.
                    if (!ch.Deferred)
                    {
                        continue;
                    }
                }
                else if (ch.Deferred)
                {
                    added = true;
                    continue;
                }
                DrawChunk(ref Camera, ref world, ch);
            }
            return(added);
        }
Exemple #7
0
 public void SetROI(Rectangle roi)
 {
     if (SetROIType == ROIType.AEROI)
     {
         //XCamera.GetInstance().SetAeState(false);
         System.Threading.Thread.Sleep(20);
         if (XCamera.GetInstance().SetAEWindow(roi.X, roi.Y, roi.Width, roi.Height))
         {
             //bool aeState;
             //XCamera.GetInstance().GetAeState(out aeState);
             //logger.Debug(string.Format("设置自动曝光窗口成功!roi: X: {0}, Y: {1}, W: {2}, H: {3}, scale: {4}", roi.X, roi.Y, roi.Width, roi.Height, scale));
             //_logger.Debug("aeState: " + aeState.ToString());
             //XCamera.GetInstance().SetAeState(true);
         }
     }
     else if (SetROIType == ROIType.WB_ROI)
     {
         XCamera.GetInstance().SetWBWindow(roi.X, roi.Y, roi.Width, roi.Height);
         XCamera.GetInstance().SetOnceWB();
     }
     else if (SetROIType == ROIType.PVW_ROI)
     {
         XCamera.GetInstance().SetPreviewROI(roi.X, roi.Y, roi.Width, roi.Height);
         XCamera.GetInstance().Play();
     }
 }
Exemple #8
0
        //private Size GetPreviewWindowRealSize()
        //{
        //    tDSImageSize tmpsize = new tDSImageSize();
        //    int m_iRelsel = 0;
        //    int nWidth = 640, nHeight = 480;
        //    tDSCameraCapability dscapability = new tDSCameraCapability();
        //    XCamera.CameraGetCapability(1, ref dscapability);
        //    if (XCamera.CameraGetImageSizeSel(1, ref m_iRelsel, false) == emDSCameraStatus.STATUS_OK)
        //    {
        //        Byte[] arrtmp = new Byte[4];
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 52, 4);
        //        nWidth = BitConverter.ToInt32(arrtmp, 0);
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 56, 4);
        //        nHeight = BitConverter.ToInt32(arrtmp, 0);
        //    }
        //    return new Size(nWidth, nHeight);
        //}
        #endregion

        //private void UpdateDisplayWindow()
        //{
        //    tDSImageSize tmpsize = new tDSImageSize();
        //    int m_iRelsel = 0;
        //    int nWidth = 640, nHeight = 480;
        //    tDSCameraCapability dscapability = new tDSCameraCapability();
        //    XCamera.CameraGetCapability(1, ref dscapability);
        //    if (XCamera.CameraGetImageSizeSel(1, ref m_iRelsel, false) == emDSCameraStatus.STATUS_OK)
        //    {
        //        Byte[] arrtmp = new Byte[4];
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 52, 4);
        //        nWidth = BitConverter.ToInt32(arrtmp, 0);
        //        XCamera.CopyMemory(Marshal.UnsafeAddrOfPinnedArrayElement(arrtmp, 0), dscapability.pImageSizeDesc + m_iRelsel * Marshal.SizeOf(tmpsize) + 56, 4);
        //        nHeight = BitConverter.ToInt32(arrtmp, 0);
        //    }

        //    pictureBox.Width = nWidth;
        //    //pictureBox.Height = nHeight - 40;
        //    pictureBox.Height = nHeight;
        //    pictureBox.Left = 0;
        //    //pictureBox.Top = 24;
        //    pictureBox.Top = 0;
        //    //---------------------------------------------------------------------------------------------------------------------------------------
        //    XCamera.CameraSetDisplaySize(1, pictureBox.Width, pictureBox.Height);
        //}

        private void PreviewForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!IsCloseWithMainForm)
                {
                    XCamera cam = XCamera.GetInstance();
                    bool    isSuccessToStopCam = false;
                    if (cam.IsActive())
                    {
                        if (cam.RunMode != emDSRunMode.RUNMODE_STOP)
                        {
                            isSuccessToStopCam = cam.Stop();
                            System.Threading.Thread.Sleep(100);
                        }
                        if (isSuccessToStopCam && cam.UnInit())
                        {
                            System.Threading.Thread.Sleep(100);
                            OnCameraClosed(new EventArgs());
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
Exemple #9
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            X = new XMain(graphics.GraphicsDevice, Services, "", freeCamera);
            //We are going to use a right hand corrdinate system switch default cull mode to refelect this
            //NOTE: Using the default model processor will not work with this since its winding order is backwards
            X.GraphicsDevice.RenderState.CullMode = CullMode.CullClockwiseFace;
#if DEBUG
            XDebugVolumeRenderer.InitializeBuffers(X.GraphicsDevice, 50);
#endif
            X.FrameRate.DisplayFrameRate = true;
            X.Console.AutoDraw           = false;
            X.Debug.StartPosition.Y      = 200;

            resources = new XResourceGroup(ref X);
            input     = new InputProcessor(ref X, this);
            menus     = new MenuManager(ref X);
            //menu to the debugnodraw list
            X.Renderer.DebugNoDraw.Add(menus);

            //Make some Cameras
            freeCamera          = new XFreeLookCamera(ref X, .1f, 1000f);
            freeCamera.Position = new Vector3(0, 10, 50);
            driverCamera        = new XFreeLookCamera(ref X, .1f, 1000f);
            chase           = new XChaseCamera(ref X, .1f, 1000f);
            currentCamera   = chase;
            X.DefaultCamera = freeCamera;

            base.Initialize();
        }
Exemple #10
0
        private void _radioGroupAntiFlick_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (!_isInit)
                {
                    XCamera cam = XCamera.GetInstance();
                    switch (_radioGroupAntiFlick.SelectedIndex)
                    {
                    case 0:              //直流
                        cam.SetAntiFlickState(false);
                        break;

                    case 1:             //50Hz
                        cam.SetAntiFlickState(true);
                        cam.SetLightFrequency(emDSLightFrequency.LIGHT_FREQUENCY_50HZ);
                        break;

                    case 2:             //60Hz
                        cam.SetAntiFlickState(true);
                        cam.SetLightFrequency(emDSLightFrequency.LIGHT_FREQUENCY_60HZ);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
Exemple #11
0
 private void InitRGBGainControls(ref tDSCameraCapability capbility)
 {
     try
     {
         //R,G,B通道增益
         float minRGain = capbility.sRgbGainRange.fRGainMin;
         float maxRGain = capbility.sRgbGainRange.fRGainMax;
         _trackBarRGain.SetRange((int)(minRGain * 100), (int)(maxRGain * 100));
         float minGGain = capbility.sRgbGainRange.fGGainMin;
         float maxGGain = capbility.sRgbGainRange.fGGainMax;
         _trackBarGGain.SetRange((int)(minGGain * 100), (int)(maxGGain * 100));
         float minBGain = capbility.sRgbGainRange.fBGainMin;
         float maxBGain = capbility.sRgbGainRange.fBGainMax;
         _trackBarBGain.SetRange((int)(minBGain * 100), (int)(maxBGain * 100));
         float rGain, gGain, bGain;
         XCamera.GetInstance().GetGain(out rGain, out gGain, out bGain);
         _trackBarRGain.Value = (int)(rGain * 100);
         _trackBarGGain.Value = (int)(gGain * 100);
         _trackBarBGain.Value = (int)(bGain * 100);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #12
0
 /// <summary>
 /// 保存图像到默认的路径下
 /// </summary>
 /// <param name="img2Save">待保存图像</param>
 /// <param name="cam">相机实例</param>
 /// <returns>保存的图像名(包含完整路径)</returns>
 private static string SaveImageToDefaultPath(Image <Bgr, Byte> img2Save, XCamera cam)
 {
     try
     {
         string imgFileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-sss");
         //if (cam.CapturePara.ImageFileType == emDSFileType.FILE_JPG)
         //    imgFileName += ".jpg";
         //else if (cam.CapturePara.ImageFileType == emDSFileType.FILE_BMP)
         //    imgFileName += ".bmp";
         //else
         //    imgFileName += ".png";
         //string fullFileName = ConfigManager.GetAppConfig("WorkPathImage") + "\\" + imgFileName;
         string fullFileName = XCamera.GetInstance().CapturePara.ImageSavePath + "\\" + imgFileName;
         img2Save.Save(fullFileName);
         XTwoExtraValueEventArgs <string, string> eventArgs = new XTwoExtraValueEventArgs <string, string>()
         {
             Data1 = fullFileName,
             Data2 = imgFileName
         };
         //PublishImageSavedEvent(eventArgs);
         return(fullFileName);
     }
     catch (System.Exception ex)
     {
         _logger.Error("保存图像时异常:" + ex.Message);
         return("");
     }
 }
Exemple #13
0
        /// <summary>
        /// 加载相机列表
        /// </summary>
        private void LoadDevList()
        {
            try
            {
                List <XCameraDevInfo> devList = XCamera.GetDevList();

                string    fieldName1 = CameraListGridFieldNames.FIELDNAME_CAMERA_NAME;
                string    fieldName2 = CameraListGridFieldNames.FIELDNAME_PORT_TYPE;
                string    fieldName3 = CameraListGridFieldNames.FIELDNAME_CAMERA_STATUS;
                DataTable dt         = new DataTable();
                dt.Columns.Add(fieldName1, typeof(string));
                dt.Columns.Add(fieldName2, typeof(string));
                dt.Columns.Add(fieldName3, typeof(string));
                devList.ForEach(x =>
                {
                    DataRow dr     = dt.NewRow();
                    dr[fieldName1] = x.FriendlyName;
                    dr[fieldName2] = "";
                    dr[fieldName3] = "已连接";
                    dt.Rows.Add(dr);
                });
                _gridControlCameraList.DataSource = dt;
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
Exemple #14
0
        private void _radioGroupFrameSpeed_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (!_isInit)
                {
                    XCamera cam = XCamera.GetInstance();
                    switch (_radioGroupFrameSpeed.SelectedIndex)
                    {
                    case 0:          //普通
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_NORMAL);
                        break;

                    case 1:         //高速
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_HIGH);
                        break;

                    case 2:         //超高速
                        cam.SetFrameSpeed(emDSFrameSpeed.FRAME_SPEED_SUPER);
                        break;

                    default:
                        break;
                    }
                    Init();
                }
            }
            catch (System.Exception ex)
            {
                _logger.Error(ex.Message);
            }
        }
Exemple #15
0
        public override void Draw(ref GameTime gameTime, ref XCamera Camera)
        {
            if (!MenuOpen)
            {
                return;            //the menu is not open DON'T DRAW IT
            }
            X.spriteBatch.Draw(Black, new Rectangle(X.GraphicsDevice.Viewport.Width - ((int)(X.GraphicsDevice.Viewport.Width * scrollamount)), 0, X.GraphicsDevice.Viewport.Width, X.GraphicsDevice.Viewport.Height), new Color(255, 255, 255, 25));
            X.spriteBatch.Draw(Background, new Rectangle(100, X.GraphicsDevice.Viewport.Height - ((int)(X.GraphicsDevice.Viewport.Height * scrollamount)), 400, X.GraphicsDevice.Viewport.Height), new Color(255, 255, 255, 191));

            int num = 0;

            foreach (string str in Buttons)
            {
                if (Buttons.IndexOf(str) == Current)
                {
                    X.spriteBatch.Draw(Button, new Rectangle(110, X.GraphicsDevice.Viewport.Height - ((int)((X.GraphicsDevice.Viewport.Height - 50) * scrollamount)) + num * 34, 380, 30), new Color(255, 255, 255, 153));
                    X.spriteBatch.DrawString(Font, str, new Vector2(115, X.GraphicsDevice.Viewport.Height - ((int)((X.GraphicsDevice.Viewport.Height - 55) * scrollamount)) + num * 34), Color.White);
                }
                else
                {
                    X.spriteBatch.Draw(OffButton, new Rectangle(110, X.GraphicsDevice.Viewport.Height - ((int)((X.GraphicsDevice.Viewport.Height - 50) * scrollamount)) + num * 34, 380, 30), new Color(255, 255, 255, 153));
                    X.spriteBatch.DrawString(Font, str, new Vector2(115, X.GraphicsDevice.Viewport.Height - ((int)((X.GraphicsDevice.Viewport.Height - 55) * scrollamount)) + num * 34), Color.LightGray);
                }

                num++;
            }

            //X.spriteBatch.Draw(logo, new Rectangle(X.GraphicsDevice.Viewport.Width - 230, X.GraphicsDevice.Viewport.Height - 176, 220, 166), new Color(255, 255, 255, 127));

            X.GraphicsDevice.RenderState.DepthBufferEnable      = true;
            X.GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
            X.GraphicsDevice.RenderState.AlphaBlendEnable       = false;
        }
Exemple #16
0
 /// <summary>
 /// 设置连拍定时器
 /// </summary>
 public void StartMutiCap()
 {
     _captureCnt = 0;
     _timerMutiCapture.Interval = XCamera.GetInstance().CapturePara.MutiCaptureTimeStep;
     _timerMutiCapture.Elapsed += _timerMutiCapture_Tick;
     _timerMutiCapture.Start();
 }
Exemple #17
0
    private void ApplyJoyStickMove()
    {
        XCamera camera = XScene.singleton.GameCamera;

        if (camera != null && XVirtualTab.singleton.Direction != Vector3.zero && CheckState())
        {
            MoveForward(XVirtualTab.singleton.Direction);
        }
    }
Exemple #18
0
 private void _spinEditMutiCaptureCnt_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.MutiCaptureCount = Convert.ToInt32(_spinEditMutiCaptureCnt.Value);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #19
0
 private void _trackBarJpgFileQulity_Scroll(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.ImageQuality = _trackBarJpgFileQulity.Value;
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #20
0
 private void _spinEditFrameStep_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         XCamera.GetInstance().CapturePara.FluModeFrameStep = Convert.ToInt32(_spinEditFrameStep.Value);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #21
0
 private void _spinEditMaxVideoSize_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         int maxVideoSize = Convert.ToInt32(_spinEditMaxVideoSize.Value);
         XCamera.GetInstance().SetMaxVideoFileSize(maxVideoSize);
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #22
0
        public void Init()
        {
            try
            {
                XCamera            cam         = XCamera.GetInstance();
                XCameraCapturePara capturePara = cam.CapturePara;

                if (capturePara.ImageFileType == emDSFileType.FILE_JPG)
                {
                    _radioGroupCaptureFileType.SelectedIndex = 0;
                }
                else if (capturePara.ImageFileType == emDSFileType.FILE_BMP)
                {
                    _radioGroupCaptureFileType.SelectedIndex = 1;
                }
                else
                {
                    _radioGroupCaptureFileType.SelectedIndex = 2;
                }

                _trackBarJpgFileQulity.Enabled = (_radioGroupCaptureFileType.SelectedIndex == 0);
                _trackBarJpgFileQulity.Value   = capturePara.ImageQuality;
                _buttonEditPicSavePath.Text    = capturePara.ImageSavePath;

                _spinEditMutiCaptureCnt.Value = capturePara.MutiCaptureCount;
                _textEditMutiCaptureTime.Text = ((double)(capturePara.MutiCaptureTimeStep) / 1000.0).ToString();

                _spinEditAccuFrameCnt.Value = capturePara.FluModeAccuFrameCnt;
                _spinEditFrameStep.Value    = capturePara.FluModeFrameStep;

                int videoQuality  = 2;
                var cameraCamType = Convert.ToInt32(ConfigManager.GetAppConfig("CameraType"));
                if (cameraCamType == 1)
                {
                    cam.GetRecordQuality(out videoQuality);
                    _radioGroupAVIQuality.SelectedIndex = videoQuality - 1;
                }
                _buttonEditVideoSavePath.Text = capturePara.VideoSavePath;
                int maxVideoSize;
                cam.GetMaxVideoFileSize(out maxVideoSize);
                _spinEditMaxVideoSize.Value = maxVideoSize;
                if (!cam.IsActive())
                {
                    _radioGroupAVIQuality.Enabled = false;
                    _spinEditMaxVideoSize.Enabled = false;
                }
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Exemple #23
0
        private static void HandleCapture(Image <Bgr, Byte> img, int pBmp24, ref tDSFrameInfo sFrInfo)
        {
            if (_captureState == CaptureState.NO_CAPTURE)
            {
                return;
            }
            XCamera cam = XCamera.GetInstance();

            //HandleSingleCapture(img, cam);
            //HandleMutiCapture(img, cam);
            HandleFluCapture(img, cam);
            HandleVideoCapture(pBmp24, ref sFrInfo);
        }
Exemple #24
0
        //  Only call Draw() once per object instance per frame. Else
        //  transparently sorted pieces won't draw correctly, as there is
        //  only one set of state per ModelDraw. Use multiple ModelDraw
        //  instances for multiple object instances.
        //  Immediately draw the parts that do not require transparency.
        //  put parts that need transparency on a deferred list, to be
        //  drawn later (z sorted) using DrawDeferred().
        public bool SceneDraw(ref XCamera Camera, Matrix World)
        {
            //  if animating, then pose it
            if (instance_ != null)
            {
                Matrix     temp;
                Keyframe[] kfs = instance_.CurrentPose;
                unchecked
                {
                    int i = 0, n = matrices_.Length;
                    foreach (Keyframe kf in kfs)
                    {
                        if (i == n)
                        {
                            break;
                        }
                        if (kf != null)
                        {
                            kf.ToMatrix(out temp);
                            //  set up the model in parent-relative pose
                            model_.Bones[i].Transform = temp;
                        }
                        ++i;
                    }
                }
            }
            //  get the object-relative matrices (object->world is separate)
            model_.CopyAbsoluteBoneTransformsTo(matrices_);
#if DEBUG
            //  draw the skeleton, but only in debug mode
            foreach (ModelBone mb in model_.Bones)
            {
                if (mb.Parent != null)
                {
                    Matrix  m = matrices_[mb.Index] * World;
                    Vector3 c = m.Translation;
                    X.DebugDrawer.DrawLine(c, (matrices_[mb.Parent.Index] * World).Translation, Color.Purple);
                    X.DebugDrawer.DrawLine(c, c + m.Right * 0.5f, Color.Red);
                    X.DebugDrawer.DrawLine(c, c + m.Up * 0.5f, Color.Green);
                    X.DebugDrawer.DrawLine(c, c + m.Backward * 0.5f, Color.Blue);
                }
            }
#endif
            //  If I have a 3x4 matrix pose, then generate that for skinning
            if (pose_ != null)
            {
                GeneratePose();
            }
            //  chain to an internal helper
            return(Draw(ref Camera, World, false));
        }
Exemple #25
0
 private void _comboBoxEditAEMode_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().SetAeMode(this._comboBoxEditAEMode.SelectedIndex))
         {
             UpdateExpControlsByAeMode(this._comboBoxEditAEMode.SelectedIndex);
         }
     }
     catch (Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
Exemple #26
0
 private void comboBoxEditCaptureRes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (!_isInit)
         {
             XCamera.GetInstance().SetCaptureSizeSel(comboBoxEditCaptureRes.SelectedIndex);
         }
     }
     catch (System.Exception ex)
     {
         _logger.Error(ex.Message);
     }
 }
Exemple #27
0
 private void _checkEnable3DAntiNoise_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().Set3DNoiseReductionState(_checkEnable3DAntiNoise.Checked))
         {
             _trackBar3DAntiNoise.Enabled = _checkEnable3DAntiNoise.Checked;
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #28
0
 /***********************************白平衡************************************/
 private void _btnOnceWB_Click(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().SetOnceWB())
         {
             this.Init();
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #29
0
 private void _checkInverse_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (!isInit)
         {
             XCamera.GetInstance().SetInverseState(_checkInverse.Checked);
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }
Exemple #30
0
 private void _btnLoadDefaultInnerPara_Click(object sender, EventArgs e)
 {
     try
     {
         if (XCamera.GetInstance().LoadParameter(emDSParameterTeam.PARAMETER_TEAM_DEFAULT))
         {
             XMessageDialog.Info("加载默认参数成功!");
         }
     }
     catch (System.Exception ex)
     {
         logger.Error(ex.Message);
     }
 }