我正在尝试使用Cinder OpenCV块对图像进行阈值化和反转。在openFrameworks中,我会使用类似以下的代码:
someImage.threshold(230, true);
...其中true是指定阈值和反转的参数。
在Cinder中,我正在尝试以下操作:
cv::threshold (input, threshNear, 230, 255, CV_THRESH_BINARY_INV);
...不起作用的代码或
cv::threshold (input, threshNear, 100, 255, CV_8U);
cv::invert ( threshNear, threshNearInverted);
有什么建议吗?
在产生错误并使程序卡住的情况下,你可以尝试以下几点: