CameraShotCls.cs 2.5 KB

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