1
我寫在OpenCV中的Android應用程序,並已花了幾個小時尋找到在C例如http://www.shervinemami.info/blobs.htmlOpenCV中cvThreshold/threshold返回的double是什麼?
常用的幾個功能的cvThreshold功能的示例程序使用像這樣 -
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個參數。文檔我發現該函數顯示相同的參數,但該函數似乎返回一個雙精度而不是無效。
的參數是 -
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
*/
謝謝您自動閾值模式THRESH_OTSU才真正有意義,這就是我認爲這可能是...所以它只是返回無論計算的閾值,作爲雙? (我認爲如果你不使用大津的方法,只處理結果,並忽略它?) – Eilidh 2012-03-06 18:18:35
我認爲它只是返回你在通話中設置的任何閾值 – 2012-03-06 18:28:06