QtCameraHardWareCopilot.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #pragma once
  2. #include <QtWidgets/QMainWindow>
  3. #include "ui_QtCameraHardWareCopilot.h"
  4. #include <list>
  5. #include "CameraItem.h"
  6. #include "CameraModifyScene.h"
  7. #include "CSdlProc.h"
  8. #include "IncCamera.h"
  9. #include "ParamSetUI.h"
  10. #include "DeviceTempleteCreator.h"
  11. #include "CameraGripper.h"
  12. #include "ImageTailor.h"
  13. #include "QtPainterModule.h"
  14. #include "preHeader.h"
  15. #include "ImageFusion.h"
  16. #include "ImageColorBalance.h"
  17. #include "VideoPrepare/CVideoDataManager.h"
  18. #include "VideoPrepare/CVideoDecoder.h"
  19. #include "VideoPrepare/CVideoSource.h"
  20. #include "VideoPrepare/CSyncProc.h"
  21. class QtCameraHardWareCopilot : public QMainWindow
  22. {
  23. Q_OBJECT
  24. public:
  25. QtCameraHardWareCopilot(QWidget *parent = nullptr);
  26. ~QtCameraHardWareCopilot();
  27. //use to update the image
  28. static bool reFreshAllCameraFrame(QtCameraHardWareCopilot* pClass);
  29. //使用Gpu的提供刷新的函数
  30. void reFreshAllCameraFrameGpu();
  31. // set a function to achieve laplace Image fusion
  32. static void LaplaceImageFusion(QtCameraHardWareCopilot* pClass);
  33. //set a function to achieve AddWeight
  34. static void AddWeightColorBalance(QtCameraHardWareCopilot* pClass);
  35. //set a thread to process the data
  36. static void ThreadProcessAll(QtCameraHardWareCopilot* pClass);
  37. static void ThreadProcessAllGpu(QtCameraHardWareCopilot* pClass);
  38. //define a function to achieve the image Mean
  39. void ThinRectWindowMeanImage(QtCameraHardWareCopilot* pClass);
  40. //声明一个函数用于将待拼接的图像放入队列
  41. void PushImageToQueue();
  42. //define a function to achieve Blending gradient image
  43. void BlendingGradientImage(QtCameraHardWareCopilot* pClass);
  44. //声明一个函数用于渐变融合图像,使用GPu
  45. void BlendingGradientImageGpu();
  46. //使用均值的方法平衡亮度
  47. void MeanWeightBalanceImage();
  48. //set a function to calculate all item intersect rect
  49. void CalculateAllItemIntersectRect();
  50. void CalculateAllItemIntersectRectWithOutBlender();
  51. //set a function to calculate the horizontal item max available rect
  52. void CalculateHorItemMaxAvailableRect(std::list<CameraItem>& RowGroup,MfcLabel::Rect& AvailableRect);
  53. //set a function to connect the signals and slots
  54. void SetConnect();
  55. //set a slot to process the paint event
  56. void paintEvent(QPaintEvent* event);
  57. //set a slot to process the Vecical Dec button clicked
  58. void OnVecDecBtnClicked();
  59. //set a slot to process the Vecical Inc button clicked
  60. void OnVecIncBtnClicked();
  61. //set a slot to process the Horizontal Dec button clicked
  62. void OnHorDecBtnClicked();
  63. //set a slot toprocess the Horizontal Inc button clicked
  64. void OnHorIncBtnClicked();
  65. //set a slot to process the CameraItem in CameraModifyScene has been selected
  66. void OnCameraItemModified();
  67. //set a slot to process the Menu signal
  68. void OnMenuBtnClicked(QAction* pAction);
  69. //reset the pano image buffer
  70. void ResetPanoImageBuffer();
  71. //for refresh the window,we need to prepare
  72. void RefreshAllSource();
  73. //free play ShowMode MouseEvent
  74. void mousePressEvent(QMouseEvent* event);
  75. void mouseMoveEvent(QMouseEvent* event);
  76. void mouseReleaseEvent(QMouseEvent* event);
  77. void wheelEvent(QWheelEvent* event);
  78. //set a function to process the comboxSelectModel signal
  79. void OnComboxSelectModel(int index);
  80. //set a funciton to release the item in close event
  81. void closeEvent(QCloseEvent* event);
  82. //set a function to read serialize ini file
  83. void ReadSerializeIniFile(QString strfilepath);
  84. //set a function to write serialize ini file
  85. void WriteSerializeIniFile(QString strfilepath);
  86. //serialize the camera info
  87. void SerializeCameraInfo(QDataStream& Stream, CAMERA_INFO* pCameraInfo,bool StoreOrLoad);
  88. //set a flag to indicate now mouse is pressed
  89. bool m_bMousePressOrNot;
  90. QPoint m_PreMousePt;
  91. private:
  92. Ui::QtCameraHardWareCopilotClass ui;
  93. //set a paintermodule to draw the image
  94. QtPainterModule m_PanoPainter;
  95. //set a pixmap to store the image
  96. QPixmap m_PanoPixmap;
  97. //set a qimage to store the image
  98. QImage m_PanoImage;
  99. //set a Qtimer to update the image
  100. QTimer* m_pUpdateTimer;
  101. //set a QGraphicsScene to store the items
  102. CameraModifyScene m_CameraQueueScene;
  103. //set a list to store the CameraItem
  104. std::list<TAG_CAM_ROW_GROUP> m_CameraItemList;
  105. //set a sdl display modual
  106. CSdlProc m_SdlProc;
  107. //
  108. CameraGripper m_CameraGripper;
  109. //set a CameraItem* to store the current selected CameraItem
  110. CameraItem* m_pCurrentCameraItem;
  111. //set a CameraInfo* to store the current selected CameraInfo
  112. CAMERA_INFO* m_pCurrentCameraInfo;
  113. PARAM_SET m_ParamSet;
  114. //set a pano image buffer
  115. unsigned char* m_pPanoImageBuffer;
  116. int m_nPanoWidth;
  117. int m_nPanoHeight;
  118. int m_nPanoPitch;
  119. unsigned char* m_pPanoImageBufferGPU{nullptr};
  120. //Current show mode
  121. ShowMode m_CurShowMode;
  122. //set a TailorModule to tailor the image
  123. //stitching tool
  124. ImageTailor m_StitchingTailor;
  125. //set a ImageFusion to fusion the image
  126. ImageFusion m_ImageFusion;
  127. //define a Image Color Balancer
  128. ImageColorBalance m_ImageColorBalance;
  129. static bool s_bSwitchProcess;
  130. std::thread* m_pRefreshProcessThread;
  131. unsigned char* m_CurrentFramePtr;
  132. bool m_bBlockThread;
  133. bool m_bBlockMainThread;
  134. bool m_bReFreshPrepared;
  135. bool m_bCameraItemModified;
  136. //define a bool to record the status of camera item move model
  137. bool m_bCameraItemMoveModel;
  138. //define two float to record the coefficient of camera substream to main stream
  139. float m_fCameraSubStreamToMainStreamWidth{ 0 };
  140. float m_fCameraSubStreamToMainStreamHeight{ 0 };
  141. };