I'm trying to threshold and invert an image with Cinder OpenCV block. In openFrameworks I would use something like that:
someImage.threshold(230, true);
...where true is the parameter to specify to threshold and invert.
In Cinder I'm trying the following:
cv::threshold (input, threshNear, 230, 255, CV_THRESH_BINARY_INV);
... that doesn't work, or
cv::threshold (input, threshNear, 100, 255, CV_8U);
cv::invert ( threshNear, threshNearInverted);
...that produces and error and let the program stuck.
Any suggestion?
Ok, after more testing I've realized that actually the way to go is
cv::threshold (input, threshNear, 70, 255, CV_THRESH_BINARY_INV);
the problem with the code I posted in my question looks like to be related with the threshold value I was trying to use (230 on 255). If I use a lower value (like for example 70 on 255) the color inversion actually works.