2012-03-06 4 views
1

私はOpenCVのでアンドロイドアプリケーションを書いている、とcvThreshold機能はそれほどのようなプログラム例で使用されているCの例で使用されるいくつかの関数http://www.shervinemami.info/blobs.htmlOpenCVのcvThreshold/thresholdによって返される倍数は正確に何ですか?

に探して、数時間を費やしてきた -

cvThreshold(planeH, planeH, 18, UCHAR_MAX, CV_THRESH_BINARY_INV); 
cvThreshold(planeS, planeS, 50, UCHAR_MAX, CV_THRESH_BINARY); 
cvThreshold(planeV, planeV, 80, UCHAR_MAX, CV_THRESH_BINARY); 

5つのパラメータ。関数で見つかったドキュメンテーションは同じパラメータを示していますが、関数はvoidではなくdoubleを返すようです。

パラメータである - 私の知る限り伝えることができる(および文書化されている)として

cvThreshold(sourceImage, destinationImage, minThreshold, maxThreshold, 
      thresholdType); 

、関数は、ベース(最小と最大閾値との)指定された範囲内にどの要素を参照するためにソース画像を確認します選択された閾値タイプに基づいて、その結果を宛先画像に出力する。しかしなぜダブルが返されるのか分かりません ...

Androidバージョンで提供されるドキュメントは以下に含まれています。

/** 
* Applies a fixed-level threshold to each array element. 
* 
* The function applies fixed-level thresholding to a single-channel array. The 
* function is typically used to get a bi-level (binary) image out of a 
* grayscale image ("compare" could be also used for this purpose) or for 
* removing a noise, that is, filtering out pixels with too small or too large 
* values. There are several types of thresholding supported by the function. 
* They are determined by "thresholdType" : 
* * THRESH_BINARY 
* 
* dst(x,y) = maxVal if src(x,y) > thresh; 0 otherwise 
* 
* * THRESH_BINARY_INV 
* 
* dst(x,y) = 0 if src(x,y) > thresh; maxVal otherwise 
* 
* * THRESH_TRUNC 
* 
* dst(x,y) = threshold if src(x,y) > thresh; src(x,y) otherwise 
* 
* * THRESH_TOZERO 
* 
* dst(x,y) = src(x,y) if src(x,y) > thresh; 0 otherwise 
* 
* * THRESH_TOZERO_INV 
* 
* dst(x,y) = 0 if src(x,y) > thresh; src(x,y) otherwise 
* 
* Also, the special value "THRESH_OTSU" may be combined with one of the above 
* values. In this case, the function determines the optimal threshold value 
* using the Otsu's algorithm and uses it instead of the specified "thresh". 
* The function returns the computed threshold value. 
* Currently, the Otsu's method is implemented only for 8-bit images. 
* 
* @param src Source array (single-channel, 8-bit of 32-bit floating point). 
* @param dst Destination array of the same size and type as "src". 
* @param thresh Threshold value. 
* @param maxval a maxval 
* @param type a type 
* 
* @see <a href="http://opencv.itseez.com/modules/imgproc/doc/miscellaneous_transformations.html#threshold">org.opencv.imgproc.Imgproc.threshold</a> 
* @see org.opencv.imgproc.Imgproc.findContours 
* @see org.opencv.core.Core.max 
* @see org.opencv.imgproc.Imgproc.adaptiveThreshold 
* @see org.opencv.core.Core.compare 
* @see org.opencv.core.Core.min 
*/ 

答えて

5

それはOtsu's method

+0

を使用して自動しきい値モードTHRESH_OTSUのためのだけは本当に有意義だダブルとして、だから、それだけで計算しきい値が何であっても返さない...それは私はそれがかもしれ思ったものだ、ありがとう? (大津の方法を使用しない場合は、結果を破棄して無視しますか?) – Eilidh

+0

コールで設定したしきい値 –

関連する問題