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

asked 2013-11-14 09:42:20 -0600

itay gravatar image

Hi,

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);
                M.add(mainMat);

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).

Thanks!

edit retag flag offensive close merge delete