#pragma once #include #include "ui_QtCameraHardWareCopilot.h" #include #include "CameraItem.h" #include "CameraModifyScene.h" #include "CSdlProc.h" #include "IncCamera.h" #include "ParamSetUI.h" #include "DeviceTempleteCreator.h" #include "CameraGripper.h" #include "ImageTailor.h" #include "QtPainterModule.h" #include "preHeader.h" #include "ImageFusion.h" #include "ImageColorBalance.h" #include "VideoPrepare/CVideoDataManager.h" #include "VideoPrepare/CVideoDecoder.h" #include "VideoPrepare/CVideoSource.h" #include "VideoPrepare/CSyncProc.h" class QtCameraHardWareCopilot : public QMainWindow { Q_OBJECT public: QtCameraHardWareCopilot(QWidget *parent = nullptr); ~QtCameraHardWareCopilot(); //use to update the image static bool reFreshAllCameraFrame(QtCameraHardWareCopilot* pClass); //使用Gpu的提供刷新的函数 void reFreshAllCameraFrameGpu(); // set a function to achieve laplace Image fusion static void LaplaceImageFusion(QtCameraHardWareCopilot* pClass); //set a function to achieve AddWeight static void AddWeightColorBalance(QtCameraHardWareCopilot* pClass); //set a thread to process the data static void ThreadProcessAll(QtCameraHardWareCopilot* pClass); static void ThreadProcessAllGpu(QtCameraHardWareCopilot* pClass); //define a function to achieve the image Mean void ThinRectWindowMeanImage(QtCameraHardWareCopilot* pClass); //声明一个函数用于将待拼接的图像放入队列 void PushImageToQueue(); //define a function to achieve Blending gradient image void BlendingGradientImage(QtCameraHardWareCopilot* pClass); //声明一个函数用于渐变融合图像,使用GPu void BlendingGradientImageGpu(); //使用均值的方法平衡亮度 void MeanWeightBalanceImage(); //set a function to calculate all item intersect rect void CalculateAllItemIntersectRect(); void CalculateAllItemIntersectRectWithOutBlender(); //set a function to calculate the horizontal item max available rect void CalculateHorItemMaxAvailableRect(std::list& RowGroup,MfcLabel::Rect& AvailableRect); //set a function to connect the signals and slots void SetConnect(); //set a slot to process the paint event void paintEvent(QPaintEvent* event); //set a slot to process the Vecical Dec button clicked void OnVecDecBtnClicked(); //set a slot to process the Vecical Inc button clicked void OnVecIncBtnClicked(); //set a slot to process the Horizontal Dec button clicked void OnHorDecBtnClicked(); //set a slot toprocess the Horizontal Inc button clicked void OnHorIncBtnClicked(); //set a slot to process the CameraItem in CameraModifyScene has been selected void OnCameraItemModified(); //set a slot to process the Menu signal void OnMenuBtnClicked(QAction* pAction); //reset the pano image buffer void ResetPanoImageBuffer(); //for refresh the window,we need to prepare void RefreshAllSource(); //free play ShowMode MouseEvent void mousePressEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event); void mouseReleaseEvent(QMouseEvent* event); void wheelEvent(QWheelEvent* event); //set a function to process the comboxSelectModel signal void OnComboxSelectModel(int index); //set a funciton to release the item in close event void closeEvent(QCloseEvent* event); //set a function to read serialize ini file void ReadSerializeIniFile(QString strfilepath); //set a function to write serialize ini file void WriteSerializeIniFile(QString strfilepath); //serialize the camera info void SerializeCameraInfo(QDataStream& Stream, CAMERA_INFO* pCameraInfo,bool StoreOrLoad); //set a flag to indicate now mouse is pressed bool m_bMousePressOrNot; QPoint m_PreMousePt; private: Ui::QtCameraHardWareCopilotClass ui; //set a paintermodule to draw the image QtPainterModule m_PanoPainter; //set a pixmap to store the image QPixmap m_PanoPixmap; //set a qimage to store the image QImage m_PanoImage; //set a Qtimer to update the image QTimer* m_pUpdateTimer; //set a QGraphicsScene to store the items CameraModifyScene m_CameraQueueScene; //set a list to store the CameraItem std::list m_CameraItemList; //set a sdl display modual CSdlProc m_SdlProc; // CameraGripper m_CameraGripper; //set a CameraItem* to store the current selected CameraItem CameraItem* m_pCurrentCameraItem; //set a CameraInfo* to store the current selected CameraInfo CAMERA_INFO* m_pCurrentCameraInfo; PARAM_SET m_ParamSet; //set a pano image buffer unsigned char* m_pPanoImageBuffer; int m_nPanoWidth; int m_nPanoHeight; int m_nPanoPitch; unsigned char* m_pPanoImageBufferGPU{nullptr}; //Current show mode ShowMode m_CurShowMode; //set a TailorModule to tailor the image //stitching tool ImageTailor m_StitchingTailor; //set a ImageFusion to fusion the image ImageFusion m_ImageFusion; //define a Image Color Balancer ImageColorBalance m_ImageColorBalance; static bool s_bSwitchProcess; std::thread* m_pRefreshProcessThread; unsigned char* m_CurrentFramePtr; bool m_bBlockThread; bool m_bBlockMainThread; bool m_bReFreshPrepared; bool m_bCameraItemModified; //define a bool to record the status of camera item move model bool m_bCameraItemMoveModel; //define two float to record the coefficient of camera substream to main stream float m_fCameraSubStreamToMainStreamWidth{ 0 }; float m_fCameraSubStreamToMainStreamHeight{ 0 }; };