Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Adding matrix to a list of matrix, causes a size changing


I would like to add a matrix to a list of matrix, but what I get is that the first matrix added well(1920x1080), but from the second matrix the size is changed to 1920x1080.

This is part of my code:

                List<Mat> M = new ArrayList<Mat>();
                Mat mainMat = new Mat();
                b = retriever.getFrameAtTime(((630 + i)/30)*1000000,MediaMetadataRetriever.OPTION_CLOSEST);
                mainMat =  new Mat(new Size(b.getWidth(),b.getHeight()),CvType.CV_8U);
                Utils.bitmapToMat(b, mainMat);
                Imgproc.cvtColor(mainMat, mainMat, Imgproc.COLOR_RGB2GRAY);

Explain: First I load frame from the retriever, the I convert the frame to OpenCV matrix and in the end add the matrix to the list (M).