, Mat. Mat double, ( , Android).
:
http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html
, :
Mat mask = new Mat(yourMat.rows(), yourMat.cols(), CvType.CV_64FC1);
Mat ones = org.opencv.core.Mat.ones(yourMat.rows(), yourMat.cols(), CvType.CV_64FC1);
Scalar alpha = new Scalar(50, CvType.CV_64FC1);
Core.multiply(ones, alpha, ones);
Core.compare(yourMat, zeros, mask, Core.CMP_LT);
Here I create a matrix with only 50 at all points. After that, I compare it with yourMat using CMP_LT (less). Thus, all pixels less than 50 will be displayed 255 in your mask and 0 if they are larger. This is a mask. So you can simply:
yourMat.copyTo(yourMat, mask);
Now all pixels greater than 50 will be zero, and all the rest will have their own values.
source
share