In MATLAB:
max(image,0)
sets the negative values to zero. Is there any available function in OpenCV to do the same?
Actually the exact same syntax works:
Mat im = cv::imread("...");
Mat im_capped = cv::max(im, 0);
Or if you want give it a matrix of zeros of the same size:
Mat thresh(im.size(), im.type(), Scalar::all(0));
Mat im_capped = cv::max(im, thresh);
According to the docs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With