[Android] How to show a camera processed frame before finish onCameraFrame method

asked 2019-07-01 13:06:47 -0500

Agus gravatar image

updated 2019-07-01 13:55:47 -0500

Hi guys, working with Aruco markers in an OpenCV an android app, I need to know if there is some way to show in the screen a frame captured with the mobilephone camera, before ending the onCameraFrame method, here is an example code:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {

    final Mat mRgba = inputFrame.rgba();
    Rect roiMarker = new Rect(100, 0, 150, 320);
    imageRoiMarker = mRgba.submat(roiMarker);
    Imgproc.rectangle(mRgba, new Point(250, 320), new Point(100, 0), new Scalar(0, 81, 255), 3);

    Imgproc.cvtColor(imageRoiMarker, imageAruco, Imgproc.COLOR_RGBA2RGB);               //convert imageRoiMArker to monochrome (gray) to detect the Aruco marker
    Aruco.detectMarkers(imageAruco, dictionary, corners, arucoIDs);                      //detect Aruco markers
    Aruco.drawDetectedMarkers(imageAruco,corners,arucoIDs,new Scalar(255, 0, 0, 255));    //draw Aruco markers
    Imgproc.cvtColor(imageAruco, imageRoiMarker, Imgproc.COLOR_RGB2RGBA);                 // from gray to RGBA
    imageRoiMarker.copyTo(mRgba.submat(roiMarker));                                       //copia la imagen en el ROIMarker

    if (!arucoIDs.empty()) {
        Log.i(TAG, "Marker " + ID + " detected");
    //////////HERE I WANT TO KNOW IF I CAN SHOW THE FRAME ON THE SCREEN BEFORE ENDING onCameraFrame method/////////////////

    } else {
        Log.i(TAG, "Following line");
    return mRgba;

Thanks so much and regards

edit retag flag offensive close merge delete


Someone can help me? Thanks so much in advance.

Agus gravatar imageAgus ( 2019-07-11 11:46:43 -0500 )edit