Ejemplo n.º 1
0
 private void PublishImageSavedEvent(XTwoExtraValueEventArgs <string, string> e)
 {
     if (ImageSavedEvent != null)
     {
         ImageSavedEvent(e);
     }
 }
Ejemplo n.º 2
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("");
     }
 }
Ejemplo n.º 3
0
        private void Snapshot()
        {
            string imgFileName  = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-sss");
            string fullFileName = XCamera.GetInstance().CaptureImage(imgFileName);

            if (!String.IsNullOrEmpty(fullFileName))
            {
                XTwoExtraValueEventArgs <string, string> eventArgs = new XTwoExtraValueEventArgs <string, string>()
                {
                    Data1 = fullFileName,
                    Data2 = imgFileName
                };
                PublishImageSavedEvent(eventArgs);
            }
        }