OpenCV的AdaptiveThreshold函数
生活随笔
收集整理的這篇文章主要介紹了
OpenCV的AdaptiveThreshold函数
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
??????? 摘自于OpenCV?Doc2.410,opencv2refman文檔.
???????
1.函數(shù)原型?
adaptiveThreshold //Applies an adaptive threshold to an array. C++: void adaptiveThreshold(InputArray src, OutputArray dst, double maxValue, int adaptiveMethod,int thresholdType, int blockSize, double C) Python: cv2.adaptiveThreshold(src, maxValue, adaptiveMethod, thresholdType, blockSize, C[, dst ]) !dst C: void cvAdaptiveThreshold(const CvArr* src, CvArr* dst, double max_value,int adaptive_method=CV_ADAPTIVE_THRESH_MEAN_C, int threshold_type=CV_THRESH_BINARY, int block_size=3, double param1=5) Python: cv.AdaptiveThreshold(src, dst, maxValue, adaptive_method=CV_ADAPTIVE_THRESH_MEAN_C,thresholdType=CV_THRESH_BINARY, blockSize=3, param1=5) ! None Parameters src – Source 8-bit single-channel image. dst – Destination image of the same size and the same type as src . maxValue – Non-zero value assigned to the pixels for which the condition is satisfied. See the details below. adaptiveMethod – Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C . See the details below. thresholdType – Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .2.圖片處理效果
原始圖片:
處理效果:
對比Canny的處理效果:
?結(jié)果就差一個(gè)反色處理?
Canny+反色
3.方法分析
參考鏈接:http://blog.chinaunix.net/uid-20805029-id-1704893.html
函數(shù) cvAdaptiveThreshold 將灰度圖像變換到二值圖像;
???? 對方法 CV_ADAPTIVE_THRESH_MEAN_C,先求出塊中的均值,再減掉param1。
???? 對方法 CV_ADAPTIVE_THRESH_GAUSSIAN_C ,先求出塊中的加權(quán)和(gaussian), 再減掉param1。
參數(shù)不同會(huì)產(chǎn)生不同的轉(zhuǎn)換效果.
???????
總結(jié)
以上是生活随笔為你收集整理的OpenCV的AdaptiveThreshold函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 期货里面的头寸是什么意思,期货投资者持有
- 下一篇: 股票佣金一般是多少