Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The opencv Mat object (java)

I'am new to opencv I want to understand the opencv Mat class

For the get method

I try the first one int get(int row, int col, byte[] data) with this example

Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );

System.out.println(mat.dump());

byte[] data = new byte[mat.cols() * mat.rows() * (int)mat.elemSize()];

System.out.println(data.length);-->9

System.out.println( mat.get(0, 0, data)); -->9 but I can't understand

1) the role of the third argument byte[] data

2) and the result

The opencv Mat object (java)

I'am new to opencv I want to understand the opencv Mat class

For the get method

I try the first one int get(int row, int col, byte[] data) with this example

 Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );

System.out.println(mat.dump());

); System.out.println(mat.dump()); byte[] data = new byte[mat.cols() * mat.rows() * (int)mat.elemSize()];

System.out.println(data.length);-->9

(int)mat.elemSize()]; System.out.println(data.length);-->9 System.out.println( mat.get(0, 0, data)); -->9

but I can't understand

1) the role of the third argument byte[] data

2) and the result