CCameraBase.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #pragma once
  2. #include <string>
  3. #include "TypeDef.h"
  4. //#include "McGlobal.h"
  5. #include "ILamp.h"
  6. /*
  7. 相机基类,用于拍照
  8. */
  9. using namespace JVision;
  10. #pragma comment(lib,"JVisionLib.lib")
  11. enum MATERIAL_TYPE
  12. {
  13. MATERIAL_NULL, //空
  14. MATERIAL_WAFER,//晶圆
  15. MATERIAL_WAFFLE,//华夫盒
  16. MATERIAL_BOX,//料盒
  17. MATERIAL_BOND //载具物料
  18. };
  19. typedef struct
  20. {
  21. int iCameraId; // 相机Id
  22. string name; // 相机名称
  23. MATERIAL_TYPE eType; //物料类型
  24. }CameraInfo;
  25. typedef long (*CallVideoBack) (int iCameraId,ImageInfo image);
  26. #ifdef CAMERA_BASE_EXPORTS
  27. #define CAMERA_BASE_DLL_API __declspec(dllexport)
  28. #else
  29. #define CAMERA_BASE_DLL_API //__declspec(dllimport)
  30. #endif
  31. class __declspec(dllexport) CCameraBase
  32. {
  33. public:
  34. CCameraBase(int id, string sDescribe,bool bEnable);
  35. ~CCameraBase(){}
  36. virtual long Open() = 0;
  37. virtual void Close() = 0;
  38. virtual long VideoStart() = 0;
  39. virtual long VideoStop() = 0;
  40. virtual long GrabImage(ImageInfo& image) = 0;
  41. virtual long SetExposure(double exposure) = 0;
  42. virtual double GetExposure() = 0;
  43. virtual long SetGain(double gain) = 0;
  44. virtual double GetGain() = 0;
  45. int GetCameraID() { return m_iCameraId; };
  46. string GetCameraDescribe() { return m_sDescribe; };
  47. bool IsEnable() { return m_bEnable; };
  48. UINT GetImageWidthCenter();
  49. UINT GetImageHeightCenter();
  50. LONG SaveImage2File(ImageInfo image, const char* fileName);//保存图像到文件
  51. //设置光源控制参数
  52. LONG SetLightChannelIndex(int type,
  53. string red_addr, int red_channel, string green_addr, int green_channel, string blue_addr, int blue_channel,
  54. string point_addr, int point_channel);
  55. //设置红光
  56. LONG SetRedLight(int LightValue);
  57. //设置绿光
  58. LONG SetGreenLight(int LightValue);
  59. //设置蓝光
  60. LONG SetBlueLight(int LightValue);
  61. //设置点光源
  62. LONG SetPointLight(int LightValue);
  63. //设置灯光
  64. LONG SetLight(int redLightValue, int greenLightValue, int blueLightValue);
  65. //获取灯光
  66. LONG GetLight(int &redLightValue, int &greenLightValue, int &blueLightValue,int &pointLightValue);
  67. void SetVideoCallBackFunc(CallVideoBack func) { m_funVideoCallBack = func; };
  68. protected:
  69. int m_iCameraId;
  70. string m_sName;
  71. string m_sDescribe;
  72. UINT m_iWidthMax = 2248; //水平方向相机最大像素
  73. UINT m_iHeightMax = 2048; //垂直方向相机是大像素
  74. bool m_bEnable = false; //相机禁止/启用
  75. double m_dExposure;
  76. double m_dGain;
  77. ILamp* m_pRedLamp = nullptr; //灯光控制器(红光)
  78. ILamp* m_pGreenLamp = nullptr; //灯光控制器(绿光)
  79. ILamp* m_pBlueLamp = nullptr; //灯光控制器(蓝光)
  80. ILamp* m_pPointLamp = nullptr; //灯光控制器(点光)
  81. INT m_iRedLightChannel; //红光通道号(-1 表示不用该种光)
  82. INT m_iGreenLightChannel; //绿光通道号(-1 表示不用该种光)
  83. INT m_iBlueLightChannel; //蓝光通道号(-1 表示不用该种光)
  84. INT m_iPointLightChannel; //点光源通道号(-1 表示不用该种光)
  85. CallVideoBack m_funVideoCallBack = nullptr;
  86. };