CameraShotCls.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using Common;
  2. using MeterPlugInLibrary;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace CarMeterSystem.OptionCls
  10. {
  11. /// <summary>
  12. /// 截图调用类
  13. /// </summary>
  14. public class CameraShotCls
  15. {
  16. public void Connection()
  17. {
  18. foreach (DhCameraShot shot in CarCache.cameraShots)
  19. {
  20. shot.Connection();
  21. }
  22. }
  23. public void Close()
  24. {
  25. foreach (DhCameraShot shot in CarCache.cameraShots)
  26. {
  27. shot.Close();
  28. }
  29. }
  30. /// <summary>
  31. /// 截图
  32. /// </summary>
  33. /// <param name="actualFirstNo">作业编号</param>
  34. public void CapPic(string actualFirstNo)
  35. {
  36. int iCnt = 1; //抓拍摄像头配置顺序必须是前面2个
  37. foreach (DhCameraShot shot in CarCache.cameraShots)
  38. {
  39. //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩
  40. //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
  41. shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
  42. iCnt++;
  43. }
  44. }
  45. /// <summary>
  46. /// 从硬盘录像机 进行截图
  47. /// </summary>
  48. /// <param name="actualFirstNo"></param>
  49. public void CapPicFromVideo(string actualFirstNo)
  50. {
  51. foreach (DhCameraShot shot in CarCache.cameraShots)
  52. {
  53. //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩
  54. //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
  55. bool shotSuccess = shot.CapPicFromVedio(PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo));
  56. PbCache.shotSuccess = shotSuccess;
  57. }
  58. }
  59. /// <summary>
  60. /// 连接视频截图并关闭
  61. /// </summary>
  62. /// <param name="actualFirstNo">作业编号</param>
  63. public void CapMethod(string actualFirstNo)
  64. {
  65. Connection();
  66. //CapPic(actualFirstNo);
  67. CapPicFromVideo(actualFirstNo);
  68. Close();
  69. }
  70. }
  71. }