Ask Your Question

Revision history [back]

Not getting current frame in Opencv

I am using OpenCV

CameraBridgeViewBase.CvCameraViewListener2

and I get frames through

onCameraFrame

function , I store it into an ArrayList by cloning

inputFrame.clone()

current frame and convert it into jpg when ArrayList has at least 10 objects But many times I get previous frames not the current frame.

    public static ArrayList<Mat> frames = new ArrayList<>();
    private static int indexNo = 0;
    @Override
        public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
                mRgba = inputFrame.rgba();
                frames.add(indexNo,mRgba.clone());
                indexNo++;

            return inputFrame.rgba();

        }