Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Two camera feeds in OpenCV4Android

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?