当前位置:网站首页>CLAHE in opencv for 16 bit image enhancement display

CLAHE in opencv for 16 bit image enhancement display

2022-06-12 10:04:00 zhoukehu91

OpenCV in CLAHE be used for 16 Bit image enhancement display


The author currently uses OpenCV Version is 4.1.0, An adaptive histogram equalization algorithm with limited contrast (Contrast Limited Adaptive Histogram Equalization, CLAOpenCV in CLAHE be used for 16 Bit image enhancement display HE) In this version... Is already supported 16 Bit image processing . The author applies it to 16 Bit image conversion 8 Bit image processing ( be used for 16 Enhanced display of bit infrared or visible light images ) And achieved good results , Share the code .

cv::Mat src(HEIGHT,WIDTH,CV_16UC1);
//... load image data to .src
cv::Mat tmp;
cv::Ptr<cv::CLAHE> clahe = createCLAHE(20.0,cv::Size(8,8));
clahe->apply(src,tmp);
double minVal,maxVal;
minMaxIdx(tmp,&minVal,&maxVal);
double scaleVal = (maxVal - minVal) > 1.0 ? (maxVal - minVal) : 1.0; // Avoid exemption 0
tmp -= minVal; // Normalize to [0-255]
tmp.convertTo(dst,CV_8UC1,255.0/scaleVal,0.0);// Normalize to [0-255]
原网站

版权声明
本文为[zhoukehu91]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206120958563490.html