搭建直播带货平台,equalizeHist直方图均衡化
作者:互联网
搭建直播带货平台,equalizeHist直方图均衡化实现的相关代码
```handlebars void equalizehist(Mat &src, Mat &dst) { dst.create(src.size(), src.type()); // 计算直方图 int histogram[256] = { 0 }; int totalnum = src.rows*src.cols; uchar *data = src.data; for (int i = 0; i < totalnum; ++i) { ++histogram[data[i]]; } //计算分布函数,也就是变换函数f(x) int LUT[256], sum = 0; for (int i = 0; i < 256; ++i) { sum += histogram[i]; LUT[i] = 255.0*sum / totalnum; } //灰度变换 uchar *dataOfSrc = src.data; uchar *dataOfDst = dst.data; for (int i = 0; i < totalnum; ++i) dataOfDst[i] = LUT[dataOfSrc[i]]; } ```
以上就是搭建直播带货平台,equalizeHist直方图均衡化实现的相关代码, 更多内容欢迎关注之后的文章
标签:src,int,均衡化,equalizeHist,++,直方图,data,totalnum 来源: https://www.cnblogs.com/yunbaomengnan/p/15019957.html