1
我正在为灰度图像写入我自己的强度直方图,其中箱的数量传递到函数中。 这是我到目前为止有:强度直方图++
std::vector<unsigned int> Image::histogram(const int bins)
{
std::vector<unsigned int> histogram(bins ,0);
for (unsigned int i(0); i < bins; i++)
{
for (unsigned int j(0); j < m_height * m_width; ++j)
{
if (i == m_p_image[j])
{
histogram[i]++;
}
}
}
return histogram;
}
为每项罪名加到直方图这完全适用于256个箱,但对128进行装仓它忽略了图像的下半年,我知道我需要实现一个如果bin大小小于256,但是我不确定如何执行此操作,将点组合在一起的方法。