0025 閾值分割運算元的說明

2021-08-29 05:36:10 字數 2210 閱讀 3680

閾值處理,用來分割影象

當影象中物體的灰度值存在差異,可以通過閾值分割的方法提取出目標所在區域

1. auto_threshold

auto_threshold(image : regions : sigma : )

直方圖自動閾值(自適應閾值)

自動閾值輸入必須是是單通道影象,會有多閾值分割,sigma用於對灰度直方圖進行高斯平滑,決定了平滑的程度(分割細緻程度),當sigma很大時,灰度直方圖基本會被平滑為只剩下乙個波峰,而分割是根據平滑後直方圖的波谷來進行的,sigma小,分割的越細緻。

2. bin_threshold

bin_threshold(image : region : : )

使用自動確定的閾值分割影象

3. binary_threshold

binary_threshold(image : region : method, lightdark : usedthreshold)

image:需要進行閾值的影象

region:處理後的區域

method:分割方法('max_separability':最大限度的可分性, 'smooth_histo':直方圖平滑)

lightdark:提取的是黑色部分還是白色部分

usedthreshold:自動閾值使用的閾值值

針對全影象進行閾值分割處理,獲得的區域要麼是亮區域,要麼是暗區域。

4. dual_threshold

dual_threshold(image : regioncrossings : minsize, mingray, threshold : )

threshold 表示用於分割的閾值數值

minsize表示分割出來的區域的最小面積(即數畫素的數目個數)

mingray表示分割出來的區域對應的原圖中影象畫素的最高灰度不能低於mingray設定值。

5. dyn_threshold

dyn_threshold(origimage, thresholdimage : regiondynthresh : offset, lightdark : )

區域性閾值分割,一般與mean_image聯合使用:

mean_image(image,mean,21,21)

dyn_threshold(image,mean, regiondynthresh,15,'dark')

當前背景之間差異明顯時,可以設定全域性閾值進行threshold,但很多情況下由於背景不均一,目標體經常表現為比背景區域性亮一些或暗一些,無法確定全域性閾值操作,需要通過其鄰域找到乙個合適的閾值進行分割。

6. fast_threshold

fast_threshold(image : region : mingray, maxgray, minsize : )

快速二值化

針對全影象進行閾值分割處理,閾值分割部分的效果和threshold是相同的,但是,該運算元還增加了最小塊的限制,直接能去掉小於minsize 的區域。

7. threshold

threshold(image : region : mingray, maxgray : )

- image是輸入影象 

- region是分割後的結果 

- mingray 和maxgray是輸入的控制引數,分割的最小灰度值與最大灰度值

針對全影象進行閾值分割處理,輸出的是最小灰度值和最大灰度值之間的區域

8. var_threshold

var_threshold(image : region : maskwidth, maskheight, stddevscale, absthreshold, lightdark : ) 

maskwidth、 maskheight是用於濾波平滑的掩膜單元;

stddevscale是標準差乘數因子(簡稱標準差因子);

absthreshold是設定的絕對閾值;

lightdark有4個值可選,』light』、』dark』、』equal』、』not_equal』。

動態閾值分割-根據區域性均值和方差 

var_threshold影象灰度值在均值與方差之和以上或在均值與方差之差以下 

需要強調的是var_threshold運算元和dyn_threshold運算元極為類似。不同的是var_threshold整合度更高,並且加入了「標準差×標準差因子」這一變數。

otsu閾值分割演算法原理 閾值分割 Otsu法

演算法實現 不呼叫函式 include include using namespace std using namespace cv 實現灰度直方圖的繪製 void drawpicture mat inpicture,mat outpicture ma hist const int bins 256...

halcon閾值分割

1.threshold image region mingray,maxgray 全域性閾值分割,適用於環境穩定,目標與背景存在明顯的灰度差的場合。read image image,clip gray histo image,image,absolutehisto,relativehisto gen...

Halcon閾值分割

1.threshold image region mingray,maxgray 全域性閾值分割,適用於環境穩定,目標與背景存在明顯的灰度差的場合。應用 1 利用灰度直方圖確定閾值進行影象分割。一般是物體與背景之間存在乙個明顯的灰度差,直方圖會存在兩個波峰乙個是目標乙個是背景,那麼閾值就是物體與背景...