在opencv中,threshold用來進行對影象(二維陣列)的二值化閾值處理
其函式原型如下:
1. c版本的:
函式原型:
void cvthreshold( const cvarr* src, cvarr* dst, double threshold,double max_value, int threshold_type );
src,dst: 不必多說,其要求型別一致性;
threshold:需要設定的閾值,當畫素值大於某個數字時,設定乙個值,否則為另外乙個值。(二值化~)
max_value:最大值;
threshold_type:可以指定閾值化的型別;
具體如下所示:
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學習之cvCreateMat的用法
cvcreatemat的用法 分配矩陣空間 cvmat cvcreatemat int rows int cols int type type 矩陣元素型別,格式為cv s u f c 如 cv 8uc1 表示8位無符號單通道矩陣 cv 32sc2 表示32位有符號雙通道矩陣 例程 cvmat m ...
OpenCV學習筆記之IplImage
首先學習下各引數的用法,以後慢慢完善 一 origin 在使用opencv顯示影象時會出現影象倒立的情況,iplimage的origin屬性有關係。origin為0表示頂左結構,即影象的原點是左上角,如果為1為左下角。一般從硬碟讀入的或者通過cvcreateimage方法建立的iplimage預設的...
opencv學習筆記之resize
前邊一篇說opencv中縮放僅有仿射變換一種,查證才知道是錯的,opencv中也有類似matlab中的imresize的函式,即是c 版的resize 當然還有影象金字塔方法 其原型為void resize inputarray src,outputarray dst,size dsize,doub...