Two camera feeds in OpenCV4Android

asked 2019-08-15 03:50:30 -0600

4ndre gravatar image

Seems like a straight forward question, but couldn't find an answer (yet). How can I read 2 camera streams on Android (front and rear) and analyse them individually. I can create 2 listeners and bind them to View elements:

    mOpenCvCameraRear = (CameraBridgeViewBase)findViewById(R.id.CameraRear);
    mOpenCvCameraFront = (CameraBridgeViewBase)findViewById(R.id.CameraFront);
    mOpenCvCameraRear.setCameraIndex(-1);
    mOpenCvCameraFront.setCameraIndex(1);
    mOpenCvCameraRear.setVisibility(CameraBridgeViewBase.VISIBLE);
    mOpenCvCameraFront.setVisibility(CameraBridgeViewBase.VISIBLE);
    mOpenCvCameraRear.setCvCameraViewListener(this);
    mOpenCvCameraFront.setCvCameraViewListener(this);

but when I enableView() both, it just crashes (each individual works). Main (or next) problem is the onCameraFrame function, which it there only once and idk how it would even decide what frame to handle. Is there a working solution for Android?

edit retag flag offensive close merge delete