几个直方图的平均直方图
The average histogram of several histograms
我为位于不同环境条件下的同一对象计算了100幅图像的H-S直方图(使用opencv),现在我需要这100幅直方图的一个平均直方图!
提前感谢
// we compute the histogram from the 0-th and 1-st channels
int channels[] = {0, 1};
calcHist( &hsv, 1, channels, Mat(), // do not use mask
hist, 2, histSize, ranges,
true, // the histogram is uniform
false );
double maxVal=0;
minMaxLoc(hist, 0, &maxVal, 0, 0);
int scale = 10;
Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3);
for( int h = 0; h < hbins; h++ )
for( int s = 0; s < sbins; s++ )
{
float binVal = hist.at<float>(h, s);
int intensity = cvRound(binVal*255/maxVal);
rectangle( histImg, Point(h*scale, s*scale),
Point( (h+1)*scale - 1, (s+1)*scale - 1),
Scalar::all(intensity),
CV_FILLED );
}
您可以尝试使用addWeighted并遍历直方图数组。
您可以将第一个权重设置为1,将第二个权重设定为1/100.00,还可以使最终直方图阵列使用浮动作为参考底图类型。
我通过访问hist1中的第一个bin,然后访问hist2中的第一个子bin来完成这项工作。。。。,hist 100中的第一个bin,并找到第一个bin的平均值,因此循环所有其他3000个bin(h_bins*S_bins=3000)
最后我得到了一个平均直方图,它适用于高级过程
相关文章:
- 为我的 c++ 类介绍制作一个三角形分类器.我有几个问题
- 使用 make 编译 MPI,几个命名空间错误,例如"错误:未知类型名称'使用'?
- 如何返回或护理项目清单基于几个类别
- 我们如何在文本文件中找到C++中的几个单词?
- 关于 std::bitset 构造函数的几个问题?
- 几个 Nt 函数在 Windows 7 x32 上返回STATUS_WAIT_0
- std::stoi 只转换前几个字符
- C++ 通过接口使用从其他几个类继承的类
- 在矢量中使用擦除时双重释放或损坏(快速顶部).如何擦除一个矢量的几个项目知道它们的索引?
- 如何遍历几个每小时一次的根(.root)文件,并将它们组合成更大的每日数据.root文件?
- 我有几个关于参考变量的问题
- 如何将几个变量复制到其他变量
- 如何在新设计中迁移需要几个额外参数的函数
- 多线程.如果我使用信号量,我可以在开始时创建很多线程还是应该只有几个线程?
- 如何在几个空行后打印文件中的输出
- recvfrom 只收到几个数据包,之后它进入等待状态
- 使用 std::vector<std::future<int>> 和 std::async 启动几个线程时中止
- C++ 两个线程,共享几个整数变量
- 在循环中使用字符串流从几个字符串中提取数字
- 几个直方图的平均直方图