我是靠谱客的博主 感性大米,这篇文章主要介绍OpenCV二值化函数Threshold,现在分享给大家,希望可以做个参考。

URL:http://wenjin.diandian.com/post/2009-02-07/16149820


研究下对图像二值化的理解 Threshold

对数组元素进行固定阈值操作

复制代码
1
2
void cvThreshold( const CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type );
src 原始数组 (单通道 , 8-bit of 32-bit 浮点数). dst 输出数组,必须与 src 的类型一致,或者为 8-bit. threshold 阈值 max_value 使用 CV_THRESH_BINARY 和 CV_THRESH_BINARY_INV 的最大值. threshold_type 阈值类型 (见讨论)

函数 cvThreshold 对单通道数组应用固定阈值操作。该函数的典型应用是对灰度图像进行阈值操作得到二值图像。(cvCmpS 也可以达到此目的) 或者是去掉噪声,例如过滤很小或很大象素值的图像点。本函数支持的对图像取阈值的方法由 threshold_type 确定:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
threshold_type=CV_THRESH_BINARY: dst(x,y) = max_value, if src(x,y)>threshold 0, otherwise threshold_type=CV_THRESH_BINARY_INV: dst(x,y) = 0, if src(x,y)>threshold max_value, otherwise threshold_type=CV_THRESH_TRUNC: dst(x,y) = threshold, if src(x,y)>threshold src(x,y), otherwise threshold_type=CV_THRESH_TOZERO: dst(x,y) = src(x,y), if (x,y)>threshold 0, otherwise threshold_type=CV_THRESH_TOZERO_INV: dst(x,y) = 0, if src(x,y)>threshold src(x,y), otherwise

下面是图形化的阈值描述:

最后

以上就是感性大米最近收集整理的关于OpenCV二值化函数Threshold的全部内容,更多相关OpenCV二值化函数Threshold内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部