本文介绍了Hist(),将Matlab代码转换为C ++吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
到底如何我们可以为Matlab函数编写C ++代码
(hist(IpImage),NumberofBins);
例如:hist(IPImage(),100);
请帮帮我;或清楚地向我解释如何在C ++中实现?
从哪里开始,基本上是灰度图像..
建议.....
Hi people,
How exactly; can we write c++ code for the Matlab function
( hist(IpImage), NumberofBins) ;
Ex: hist(IPImage(),100);
Please help me out; or explain me clearly how to implement in C++?
where to start, basically its a gray scale image..
Suggestions pls .....
推荐答案
unsigned int histo [256];
memset (histo, 0, sizeof histo);
for (int y = 0; y < height; ++y)
{
BYTE* p = pBuffer + y * lineWidth;
for (int x = 0; x < width; ++x)
histo[*p++] += 1;
}
// now the array hist will contain the histogram of the image.
各种不同的图像格式带来了更多的复杂性.但是主体保持不变.
More complexity comes in with the variety of different image formats. But the principal stays the same.
这篇关于Hist(),将Matlab代码转换为C ++吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!