#pragma once //MV_EM 1400C Ïà»ú¿ª·¢°ü #include "MyCameraBase.h" #ifdef _WIN64 #include ".\MV_SDK64\MVGigE.h" #include ".\MV_SDK64\MVImage.h" #else #include ".\MV_SDK\MVGigE.h" #include ".\MV_SDK\MVImage.h" #endif #include //#include "Gdiplus.h" // ¶àMVÏà»úÀàÎļþ class MVCamera2 : public MyCamera { public: MVCamera2(void); ~MVCamera2(void); private: volatile static int LabInited; //³ÌÐò¿âÊÇ·ñÒѾ­³õʼ»¯£¬ÒÔ¼°³õʼ»¯µÄ´ÎÊý¡£ volatile static int TotalCameraCount; public: HANDLE m_hCam; //´ò¿ªµÄÏà»ú¾ä±ú MVImage m_Raw; //ԭʼͼÏñ MVImage m_image; //Õý³£Í¼Ïñ double m_fExpo; //! Æعâʱ¼ä,uS volatile int Grabok; volatile int TrigeredCount; volatile int BackCallCount; static int InitLib(); int GetCameraCount(){return TotalCameraCount;} int GetCameraInfo(int index, MyCameraInfo * pMyCameraInfo); int OpenCamera(int Index); int CloseCamera(); int GetCameraWidthHeight(int * nWidth, int * nHeight) { *nWidth=m_nWidth; *nHeight=m_nHeight; return CameraOk; }; int GetCameraPixelFormat() { return m_PixelFormat; }; int GetExposureTime(double *ExposureTime); int SetExposureTime(double ExposeTime); int GetWidth(int *nWidth) { if (MVGetWidth(m_hCam,nWidth)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetWidthRange(int *WidthMin,int *WidthMax) { if (MVGetWidthRange(m_hCam,WidthMin,WidthMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetWidthInc(int *WidthInc) { if (MVGetWidthInc(m_hCam,WidthInc)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetWidth(int nWidth) { if (MVSetWidth(m_hCam,nWidth)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetHeight(int *nHeight) { if (MVGetHeight(m_hCam,nHeight)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetHeightRange(int *HeightMin,int *HeightMax) { if (MVGetHeightRange(m_hCam,HeightMin,HeightMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetHeightInc(int *HeightInc) { return CameraError; }; int SetHeight(int nHeight) { if (MVSetHeight(m_hCam,nHeight)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetOffsetXRange(int *OffsetXMin,int *OffsetXMax) { if (MVGetOffsetXRange(m_hCam,OffsetXMin,OffsetXMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetOffsetYRange(int *OffsetYMin,int *OffsetYMax) { if (MVGetOffsetYRange(m_hCam,OffsetYMin,OffsetYMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetOffsetX(int *OffsetX) { if (MVGetOffsetX(m_hCam,OffsetX)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetOffsetY(int *OffsetY) { if (MVGetOffsetY(m_hCam,OffsetY)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetOffsetX(int nOffsetX) { if (MVSetOffsetX(m_hCam,nOffsetX)==MVST_SUCCESS) return CameraOk; else return CameraError; } int SetOffsetY(int nOffsetY) { if (MVSetOffsetY(m_hCam,nOffsetY)==MVST_SUCCESS) return CameraOk; else return CameraError; } int SetROI(int nOffsetX, int nOffsetY, int nWidth, int nHeight) { int WidthMax,WidthMin,WidthInc,HeightMax,HeigtMin,OffsetXMin,OffsetXMax,OffsetYMin,OffsetYMax; if (MVGetWidthRange(m_hCam,&WidthMin,&WidthMax)!=MVST_SUCCESS) return CameraError; if (MVGetWidthInc(m_hCam,&WidthInc)!=MVST_SUCCESS) return CameraError; if (WidthInc==0) return CameraError; if (MVGetHeightRange(m_hCam,&HeigtMin,&HeightMax)!=MVST_SUCCESS) return CameraError; if (MVGetOffsetXRange(m_hCam,&OffsetXMin,&OffsetXMax)!=MVST_SUCCESS) return CameraError; if (MVGetOffsetYRange(m_hCam,&OffsetYMin,&OffsetYMax)!=MVST_SUCCESS) return CameraError; if (nWidthWidthMax) return CameraError; if ((nWidth%WidthInc)!=0) return CameraError; if (nHeightHeightMax) return CameraError; if (nOffsetXOffsetXMax) return CameraError; if (nOffsetYOffsetYMax) return CameraError; if (nOffsetX+nWidth>WidthMax) return CameraError; if (nOffsetY+nHeight>HeightMax) return CameraError; if (MVSetOffsetX(m_hCam,0)!=MVST_SUCCESS) return CameraError; if (MVSetOffsetY(m_hCam,0)!=MVST_SUCCESS) return CameraError; if (MVSetWidth(m_hCam,nWidth)!=MVST_SUCCESS) return CameraError; if (MVSetHeight(m_hCam,nHeight)!=MVST_SUCCESS) return CameraError; if (MVSetOffsetX(m_hCam,nOffsetX)!=MVST_SUCCESS) return CameraError; if (MVSetOffsetY(m_hCam,nOffsetY)!=MVST_SUCCESS) return CameraError; return CameraOk; }; int GetGain(double *Gain) { if (MVGetGain(m_hCam,Gain)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetGainRange(double *GainMin,double *GainMax) { if (MVGetGainRange(m_hCam,GainMin,GainMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetGain(double Gain) { if (MVSetGain(m_hCam,Gain)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetGamma(double *Gamma) { if (MVGetGamma(m_hCam,Gamma)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetGammaRange(double *GammaMin,double *GammaMax) { if (MVGetGammaRange(m_hCam,GammaMin,GammaMax)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetGamma(double Gamma) { if (MVSetGamma(m_hCam,Gamma)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int GetLUTEnable(int *bIsEnable) { if (MVGetEnableLUT(m_hCam,bIsEnable)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetLUTEnable(int bIsEnable) { if (MVSetEnableLUT(m_hCam,bIsEnable)==MVST_SUCCESS) return CameraOk; else return CameraError; }; int SetLUT(int *pBuf,int nCount) { unsigned long buf1[1024]; for (int i=0;i