Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to convert mat to two-dimensional array (int) in android

i want to quantify pixels into 8 gray levels, and i have to change the mat into 2 dimensional array, can any one help me? thank you

Bitmap bitmap = grayscale.copy(Bitmap.Config.ARGB_8888,true);
                mat.convertTo(mat, CvType.CV_8U);
                int channels = mat.channels();
                int row  = mat.rows();
                int col = mat.cols() * channels;

                double[][] matrix = new double[row][col];

this is the code I use