Ask Your Question

Revision history [back]

How to use setTo() in JAVA

    Mat gray = new Mat();
    Utils.bitmapToMat(grayBitmap,gray);
    Mat blocks = new  Mat(gray.size(),gray.type());
    Core.randu(blocks,0,1);
    blocks.setTo(0,blocks<0.3);
    blocks.setTo(1,blocks>0.3);

I use android studio to build the code, but it told me that "Operator '>' cannot be applied to 'org.opencv.core.Mat', 'double' " for blocks >/<0.3 parts, is that mean I cant use this method in Java or I need to add something else?