#pragma once #include #include "OptimizeCal.h" #include "ImageFusion.h" #include "MfcLabel.h" const int BALANCE_WIDEN = 40; class ImageColorBalance { public: //construction ImageColorBalance(); //set a function to initialize the color balance ImageFusion void Init(unsigned char * pImage, int nPanoWidth, int nPanoHeight, int nPanoPitch, int nCameraWidth,int nCameraHeight,int nCameraPitch, int nRefreshFrequency); /********************************Border Color Fusion*************************************/ //set a function to use border color to fusion the image void FusionImageByBorderColor(unsigned char* pPano, cv::Rect InferRc, unsigned char* pCvTarget, cv::Rect TargetOverlapRc); //reweight the Mask image void GetGradientMask(cv::Rect Infer, cv::Rect Target, cv::Mat& MaskTarget, cv::Mat& MaskInfer, std::vector& bAddOrSub); //set a function to get the result void GetColorBalanceImage(unsigned char* pFusionImage, int& nWidth, int& nHeight, int& nPitch); //get cur refresh frequency count int& GetRefreshFrequency(); //get the stand frequency const int GetStdRefreshFrequency(); /**********************************Auto Light Balance**********************************************/ //输入进来的是rgb数据 int FusionImageByAutoLightBalance(unsigned char* pPano, cv::Rect InferRc, unsigned char* pCvTarget, cv::Rect TargetOverlapRc); /************************************ACE*******************************************/ cv::Mat stretchImage(cv::Mat src); cv::Mat getPara(int radius); cv::Mat NormalACE(cv::Mat src, int ratio, int radius); cv::Mat FastACE(cv::Mat src, int ratio, int radius); cv::Mat getACE(cv::Mat src, int ratio, int radius); /*************************************交叉区域均值配平*************************************************************/ //当前版本为输入rgb数据 //int InterectRectFusionColorBalance(cv::Mat& Infer, float fInferToTarget, cv::Mat& InferAfterBlance); //获取相交区域的系数差值 void InterectRectDiff(cv::Mat& Infer, cv::Mat& Target,float & fInferToTarget_mul,float& fInferMean); //配平链上的参数 void FlatParamInChain(std::vector& vInSubParams,std::vector& vOutParams); // void IntersectRectChange(cv::Mat& InferImg,cv::Mat& TargetImg,cv::Rect InferRc,cv::Rect TargetRc,float fInferToTarget_mul); //创建过渡区权重图 //void GetGradient private: //set a pointer to store the pano image data unsigned char* m_pPanoImageBuffer; //pano Image Width int m_nPanoWidth; //pano Image Height int m_nPanoHeight; //pano Image Pitch int m_nPanoPitch; //Camera Image Size and pitch int m_nCameraWidth; int m_nCameraHeight; int m_nCameraPitch; //refresh the Image Weight Map frequency int m_nRefreshFrequency; //current refresh frequency int m_nCurrentRefreshFrequency; //渐变的权重图 cv::Mat m_InferWeightMask; };