Ask Your Question

Revision history [back]

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);
                Utils.bitmapToMat(bitmap,mat);
                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