ImageColorBalance.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma once
  2. #include <opencv2/opencv.hpp>
  3. #include "OptimizeCal.h"
  4. #include "ImageFusion.h"
  5. #include "MfcLabel.h"
  6. const int BALANCE_WIDEN = 40;
  7. class ImageColorBalance
  8. {
  9. public:
  10. //construction
  11. ImageColorBalance();
  12. //set a function to initialize the color balance ImageFusion
  13. void Init(unsigned char * pImage, int nPanoWidth, int nPanoHeight, int nPanoPitch, int nCameraWidth,int nCameraHeight,int nCameraPitch, int nRefreshFrequency);
  14. /********************************Border Color Fusion*************************************/
  15. //set a function to use border color to fusion the image
  16. void FusionImageByBorderColor(unsigned char* pPano, cv::Rect InferRc, unsigned char* pCvTarget, cv::Rect TargetOverlapRc);
  17. //reweight the Mask image
  18. void GetGradientMask(cv::Rect Infer, cv::Rect Target, cv::Mat& MaskTarget, cv::Mat& MaskInfer, std::vector<bool>& bAddOrSub);
  19. //set a function to get the result
  20. void GetColorBalanceImage(unsigned char* pFusionImage, int& nWidth, int& nHeight, int& nPitch);
  21. //get cur refresh frequency count
  22. int& GetRefreshFrequency();
  23. //get the stand frequency
  24. const int GetStdRefreshFrequency();
  25. /**********************************Auto Light Balance**********************************************/
  26. //输入进来的是rgb数据
  27. int FusionImageByAutoLightBalance(unsigned char* pPano, cv::Rect InferRc, unsigned char* pCvTarget, cv::Rect TargetOverlapRc);
  28. /************************************ACE*******************************************/
  29. cv::Mat stretchImage(cv::Mat src);
  30. cv::Mat getPara(int radius);
  31. cv::Mat NormalACE(cv::Mat src, int ratio, int radius);
  32. cv::Mat FastACE(cv::Mat src, int ratio, int radius);
  33. cv::Mat getACE(cv::Mat src, int ratio, int radius);
  34. /*************************************交叉区域均值配平*************************************************************/
  35. //当前版本为输入rgb数据
  36. //int InterectRectFusionColorBalance(cv::Mat& Infer, float fInferToTarget, cv::Mat& InferAfterBlance);
  37. //获取相交区域的系数差值
  38. void InterectRectDiff(cv::Mat& Infer, cv::Mat& Target,float & fInferToTarget_mul,float& fInferMean);
  39. //配平链上的参数
  40. void FlatParamInChain(std::vector<float>& vInSubParams,std::vector<float>& vOutParams);
  41. //
  42. void IntersectRectChange(cv::Mat& InferImg,cv::Mat& TargetImg,cv::Rect InferRc,cv::Rect TargetRc,float fInferToTarget_mul);
  43. //创建过渡区权重图
  44. //void GetGradient
  45. private:
  46. //set a pointer to store the pano image data
  47. unsigned char* m_pPanoImageBuffer;
  48. //pano Image Width
  49. int m_nPanoWidth;
  50. //pano Image Height
  51. int m_nPanoHeight;
  52. //pano Image Pitch
  53. int m_nPanoPitch;
  54. //Camera Image Size and pitch
  55. int m_nCameraWidth;
  56. int m_nCameraHeight;
  57. int m_nCameraPitch;
  58. //refresh the Image Weight Map frequency
  59. int m_nRefreshFrequency;
  60. //current refresh frequency
  61. int m_nCurrentRefreshFrequency;
  62. //渐变的权重图
  63. cv::Mat m_InferWeightMask;
  64. };