1 | initial version |
what is your OpenCV version? i tested with OpenCV 3.4 and setting IMWRITE_PNG_BILEVEL to 1 seems working
2 | No.2 Revision |
what is your OpenCV version? i tested with OpenCV 3.4 and setting IMWRITE_PNG_BILEVEL to 1 seems working
test code:
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfInt;
import org.opencv.imgcodecs.Imgcodecs;
public class test
{
public static void main( String[] args )
{
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat img = new Mat(1000, 1000, CvType.CV_8UC1);
Core.randu(img, 0, 2);
MatOfInt parameters = new MatOfInt(
Imgcodecs.IMWRITE_PNG_BILEVEL, 1
);
Imgcodecs.imwrite("c:/test/test.png", img, parameters);
}
}
result image is 126.283 bayt