日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenCV的AdaptiveThreshold函数

發布時間:2023/12/31 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenCV的AdaptiveThreshold函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

??????? 摘自于OpenCV?Doc2.410,opencv2refman文檔.

???????

1.函數原型?

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的處理效果:


?結果就差一個反色處理?

Canny+反色



3.方法分析

參考鏈接:http://blog.chinaunix.net/uid-20805029-id-1704893.html

函數 cvAdaptiveThreshold 將灰度圖像變換到二值圖像;

???? 對方法 CV_ADAPTIVE_THRESH_MEAN_C,先求出塊中的均值,再減掉param1。
???? 對方法 CV_ADAPTIVE_THRESH_GAUSSIAN_C ,先求出塊中的加權和(gaussian), 再減掉param1。

參數不同會產生不同的轉換效果.


???????

總結

以上是生活随笔為你收集整理的OpenCV的AdaptiveThreshold函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。