持续记录中~~~
这个函数求取三个通道中最小值,然后以最小值组成一幅灰度图-darkchannel,并返回大气强度A
double darkChannel(const cv::Mat &src,cv::Mat &dst){
cv::Mat rawtemp;
rawtemp.create(src.size(),src.type());
for (int i = 0; i < height; i++) {
const uchar* imgP = src.ptr<uchar>(i);
uchar* dstP = rawImage.ptr<uchar>(i);
for (int j = 0; j < width; j++) {
int b=imgP[3*j];
int g=imgP[3*j+1];
int r=imgP[3*j+2];
dstP[j] = IMAGE_MIN(IMAGE_MIN(b,g),r);
}
}
//把图像分成patch,求patch框内的最小值,得到dark_channel image//range 0-255 center(i,j),every pixel (i,j) of rawtemp's value is Rect minvalue// dx is patchSize/2//rawtemp is the return of function of minChannel
cv::Mat rect_img;
for(int j=0;j<height;j++){
for(int i=0;i<width;i++){
cv::getRectSubPix(rawtemp,cv
整理何凯明去雾算法代码优化
最新推荐文章于 2024-05-20 21:54:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)