1 import org.opencv.core.Core; 2 import org.opencv.core.Mat; 3 import org.opencv.core.CvType; 4 import org.opencv.core.Scalar; 5 6 class SimpleSample { 7 8 static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); } 9 main(String[] args)10 public static void main(String[] args) { 11 System.out.println("Welcome to OpenCV " + Core.VERSION); 12 Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0)); 13 System.out.println("OpenCV Mat: " + m); 14 Mat mr1 = m.row(1); 15 mr1.setTo(new Scalar(1)); 16 Mat mc5 = m.col(5); 17 mc5.setTo(new Scalar(5)); 18 System.out.println("OpenCV Mat data:\n" + m.dump()); 19 } 20 21 } 22