Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which function can I use in opencv as max() in matlab

In MATLAB:

max(image,0)

sets the negative values to zero. Is there any available function in OpenCV to do the same?

like image 766
MerveMeriç Avatar asked Dec 15 '22 21:12

MerveMeriç


1 Answers

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:

cv::max

like image 73
Amro Avatar answered Dec 26 '22 14:12

Amro