ECOMCalibration.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //---------------------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 2023, E-COM All rights reserved.
  4. //
  5. // FileName: ZSKKCalibration.h
  6. // Description: Header file for class ZSKK calibration,
  7. // it is the base class of ZSKK calibration operation for commom detector
  8. // Version: 1.0
  9. // Author: Wangyuedong
  10. // Date: 2023/10/10
  11. //
  12. //---------------------------------------------------------------------------------------
  13. #pragma once
  14. #pragma warning(disable:26451) //算术溢出 : 使用 4 字节值上的运算符 * ,然后将结果转换到 8 字节值。在调用运算符 * 之前将值强制转换为宽类型可避免溢出(io.2)。
  15. #define ZSKK_CALIBRATION_API __declspec(dllexport)
  16. #define FALSE 0
  17. #define TRUE 1
  18. #include <string>
  19. #include "GridSuppression.h"
  20. #include "GainMatrix.h"
  21. #include "PixMatrix.h"
  22. typedef unsigned short WORD;
  23. class ZSKK_CALIBRATION_API CZSKKCalibrationCtrl
  24. {
  25. public:
  26. CZSKKCalibrationCtrl();
  27. ~CZSKKCalibrationCtrl();
  28. //去栅影
  29. bool GridSuppressed(int nHeight, int nWidth, unsigned short* pImage);
  30. //图像预处理接口
  31. bool CreateEmptyMap(int nImgHeight, const char* pcRefPath);
  32. //int JudgeDarkImage(WORD* pOldData, WORD* pNewData, int nImgWidth, int nImgHeight);
  33. //int JudgeWhiteImage(WORD* pwData, int nWidth, int nHeight, int nWidthOffset, int nHeightOffset, unsigned short nCurrentTargetDV);
  34. bool CreateGainMatrix(CGainMatrix* pGainMatrix, int nWidth, int nHeight, int nWidthOffset, int nHeightOffset, int nRefrenceNum, WORD wMaxPv);
  35. bool BeginGainCalibration(CGainMatrix* pGainMatrix, int nWidth, int nHeight, int nWidthOffset, int nHeightOffset, int nRefrenceNum, WORD wMaxPv);
  36. //bool GetEffectiveImage(ZSKK_IMAGE_INFO* pOutImg, WORD* pInImg, int nInWidth);
  37. //增益校正接口
  38. bool LoadZSKKGainMap(bool bInit = true, std::string strSerial = "");
  39. bool UnLoadZSKKGainMap();
  40. bool ApplyZSKKGainMap(WORD* pImage);
  41. bool AverageZSKKGainMap(WORD* wImage, int, bool bStart);
  42. bool StoreZSKKGainMap(std::string strSerial = "");
  43. //坏点校正接口
  44. bool LoadZSKKPixelMap(bool bInit = true, std::string strSerial = "");
  45. bool UnLoadZSKKPixMap();
  46. bool ApplyZSKKPixMap(WORD* pImage);
  47. bool AddImageToPixMap(WORD* pImage);
  48. bool AbortZSKKPixMap(std::string strSerial = "");
  49. bool StoreZSKKPixMap(std::string strSerial = "");
  50. bool ApplyZSKKReference(int, int, WORD*);
  51. bool LoadZSKKLineMap(std::string strSerial = "");
  52. bool ApplyZSKKLineMap(WORD* pImage);
  53. bool GridBadLineCorrectFirst(int nHeight, int nWidth, unsigned short* pImage);
  54. bool GridBadLineCorrectSecond(int nHeight, int nWidth, unsigned short* pImage);
  55. bool SaveRawImage(const char* pImgName, const WORD* pRawImg, int nWidth, int nHeight);
  56. bool ApplyImageSaturation(WORD* pImage, int nWidth, int nHeight, int nSaturation);
  57. public:
  58. int m_nGridSuppressed;
  59. int m_nSaveRawDataMode;
  60. int m_nSaturationValue;
  61. std::string m_strRawImgPath; //保存Raw图的路径,以\\结尾
  62. std::string m_strRefFilePath; //保存校正文件的路径,以\\结尾
  63. int m_nHeightOffset;
  64. int m_nWidthOffset;
  65. int m_nFullImgWidth;
  66. int m_nFullImgHeight;
  67. bool m_bAutoBadPixel; //坏点校正开关,默认开启
  68. int m_nReferenceNum;
  69. private:
  70. CGainMatrix* m_pZSKKGainMatrix;
  71. CPixMatrix* m_pZSKKPixMatrix;
  72. };