我正在使用Cimg库
我有一张图片:CImg image;
CImgDisplay main_disp;
我想在主_ image
disp
的直方图
答案 0 :(得分:1)
以下是CImg文档: http://cimg.sourceforge.net/reference/index.html
并且,这里有一些代码可以从图像计算直方图并将其显示在预先存在的显示器上:
// create display and image
CImg< float > image;
CImgDisplay< float > main_disp;
// do some stuff to populate image ...
// compute the histogram
const CImg< float > histogram = img.histogram( numberOfBins );
// display histogram on display
main_disp.display( histogram );
// wait until display is closed
while ( !main_disp.is_closed() ) { main_disp.wait(); }