#pragma once #include #include "TypeDef.h" //#include "McGlobal.h" #include "ILamp.h" /* 相机基类,用于拍照 */ using namespace JVision; #pragma comment(lib,"JVisionLib.lib") enum MATERIAL_TYPE { MATERIAL_NULL, //空 MATERIAL_WAFER,//晶圆 MATERIAL_WAFFLE,//华夫盒 MATERIAL_BOX,//料盒 MATERIAL_BOND //载具物料 }; typedef struct { int iCameraId; // 相机Id string name; // 相机名称 MATERIAL_TYPE eType; //物料类型 }CameraInfo; typedef long (*CallVideoBack) (int iCameraId,ImageInfo image); #ifdef CAMERA_BASE_EXPORTS #define CAMERA_BASE_DLL_API __declspec(dllexport) #else #define CAMERA_BASE_DLL_API //__declspec(dllimport) #endif class __declspec(dllexport) CCameraBase { public: CCameraBase(int id, string sDescribe,bool bEnable); ~CCameraBase(){} virtual long Open() = 0; virtual void Close() = 0; virtual long VideoStart() = 0; virtual long VideoStop() = 0; virtual long GrabImage(ImageInfo& image) = 0; virtual long SetExposure(double exposure) = 0; virtual double GetExposure() = 0; virtual long SetGain(double gain) = 0; virtual double GetGain() = 0; int GetCameraID() { return m_iCameraId; }; string GetCameraDescribe() { return m_sDescribe; }; bool IsEnable() { return m_bEnable; }; UINT GetImageWidthCenter(); UINT GetImageHeightCenter(); LONG SaveImage2File(ImageInfo image, const char* fileName);//保存图像到文件 //设置光源控制参数 LONG SetLightChannelIndex(int type, string red_addr, int red_channel, string green_addr, int green_channel, string blue_addr, int blue_channel, string point_addr, int point_channel); //设置红光 LONG SetRedLight(int LightValue); //设置绿光 LONG SetGreenLight(int LightValue); //设置蓝光 LONG SetBlueLight(int LightValue); //设置点光源 LONG SetPointLight(int LightValue); //设置灯光 LONG SetLight(int redLightValue, int greenLightValue, int blueLightValue); //获取灯光 LONG GetLight(int &redLightValue, int &greenLightValue, int &blueLightValue,int &pointLightValue); void SetVideoCallBackFunc(CallVideoBack func) { m_funVideoCallBack = func; }; protected: int m_iCameraId; string m_sName; string m_sDescribe; UINT m_iWidthMax = 2248; //水平方向相机最大像素 UINT m_iHeightMax = 2048; //垂直方向相机是大像素 bool m_bEnable = false; //相机禁止/启用 double m_dExposure; double m_dGain; ILamp* m_pRedLamp = nullptr; //灯光控制器(红光) ILamp* m_pGreenLamp = nullptr; //灯光控制器(绿光) ILamp* m_pBlueLamp = nullptr; //灯光控制器(蓝光) ILamp* m_pPointLamp = nullptr; //灯光控制器(点光) INT m_iRedLightChannel; //红光通道号(-1 表示不用该种光) INT m_iGreenLightChannel; //绿光通道号(-1 表示不用该种光) INT m_iBlueLightChannel; //蓝光通道号(-1 表示不用该种光) INT m_iPointLightChannel; //点光源通道号(-1 表示不用该种光) CallVideoBack m_funVideoCallBack = nullptr; };