public static void draw() { // Vector<Point> p = new Vector<Point>(); // Point p1 = new Point(1,0); // p1.setLocation(2, 7); // p.addElement(p1); // p1.setLocation(5, 7); // p.addElement(p1); // p1.setLocation(1, 3); // p.addElement(p1); // p1.setLocation(2, 4); // p.addElement(p1); // p1.setLocation(5, 1); // p.addElement(p1); // Vector<double[]> points = new Vector<double[]>(); double[] p1 = {0.25, 0.82}; double[] p2 = {0.73, 0.16}; double[] p3 = {0.12, 0.21}; double[] p4 = {0.92, 0.80}; double[] p5 = {0.16, 0.46}; points.addElement(p1); points.addElement(p2); points.addElement(p3); points.addElement(p4); points.addElement(p5); Mat mp = DataConverter.jvector2Mat(points); // System.out.println(mp.dump()); // new Visu(points); }
public static void V2M() { Vector<double[]> v = new Vector<double[]>(); double[] temp = {1.0, 2.0, 3.0, 4.0}; v.add(temp); v.add(temp); v.add(temp); Mat m = DataConverter.jvector2Mat(v); System.out.println(m.dump()); }
public static void M2V() { Mat data = new Mat(3, 4, CvType.CV_32F) { { put(0, 0, 1, 2, 2, 4); put(1, 0, 2, 4, 4, 8); put(2, 0, 3, 6, 6, 12); } }; Vector<double[]> v = DataConverter.mat2Jvector(data); // VecOperation.printVectorArray(v); }