如何在OPenCV中计算32位浮点图像的图像直方图 [英] How to calculate image histogram of 32bit floating point image in OPenCV

查看:431
本文介绍了如何在OPenCV中计算32位浮点图像的图像直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算图像的直方图,像素的类型为32F(32位浮点数). "calcHist"函数的参数值应用于: -昏暗 -垃圾桶 -范围

I want to calculate histogram of an image hows pixels are of type 32F (32 bit floating point). What should be the parameter values of "calcHist" function for: - dims - bins - range

推荐答案

我已经做了很多次.像这样:

Well I've done this many times. Something like so:

cv::Mat matSrc;    // this is a CV_32FC1 normalised image

int nHistSize = 65536;
float fRange[] = { 0.0f, 1.0f };
const float* fHistRange = { fRange };

cv::Mat matHist;
cv::calcHist(&matSrc, 1, 0, cv::Mat(), matHist, 1, &nHistSize, &fHistRange);

文档中的描述了源数组:

源数组.它们都应具有相同的深度CV_8U或CV_32F, 和相同的大小.他们每个人都可以有任意数量的 渠道.

Source arrays. They all should have the same depth, CV_8U or CV_32F , and the same size. Each of them can have an arbitrary number of channels.

因此支持CV_32F.在这种情况下,范围(在我的示例中为0.0到1.0)被归类为所需箱数(在我的示例中为65536).

So CV_32F is supported. In this situation, the range (in my example 0.0 to 1.0) is binned into the number of bins required (in my example 65536).

这篇关于如何在OPenCV中计算32位浮点图像的图像直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆