我正在写在OpenCV中的Android应用程序,并已花了几个小时寻找到在C示例中使用的一些功能http://www.shervinemami.info/blobs.html
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);
Run Code Online (Sandbox Code Playgroud)
有5个参数.我在函数中找到的文档显示了相同的参数,但函数似乎返回了double而不是void.
参数是 -
cvThreshold(sourceImage, destinationImage, minThreshold, maxThreshold,
thresholdType);
Run Code Online (Sandbox Code Playgroud)
据我可以告诉(和是记录),功能检查源图像以查看哪些元素落入指定范围内(最小值和最大值之间的阈值)的基础上选择的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
*/
Run Code Online (Sandbox Code Playgroud)