0

I'm trying doing something like this OpenCV (Java) : Draw a rectangle region on Camera View is the same work but for me it does not work. I'm using opencv for android version 3.4.10 I also tested it using opencv 3.4.7 but does not work. Here is my code:

  @Override
    public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
        if(mRgba!=null){
            mRgba.release();
        }
        mRgba = inputFrame.rgba();
          
        int w = mRgba.width();
        int h = mRgba.height();

        Imgproc.rectangle(mRgba, new Point(w * 1 / 3, h * 1 / 3), new Point(
                w * 2 / 3, h * 2 /  3 ), new Scalar( 255, 0, 0 ), 5
        );
        
        return mRgba;
    }

The application only is showing the normal image without any rectangle.
enter image description here


I don't know really why it does not work, please guys if you have any idea about how fix it I will appreciate it. Thanks in advance.

Freddy Daniel
  • 369
  • 2
  • 16
  • Recently I just tried with opencv 3.2.0 but the rectangle don't appear. Please guys any idea I will appreciate.. – Freddy Daniel Mar 27 '21 at 00:03
  • I fixed it in the OnCreate I had this cameraBridgeViewBase = (JavaCameraView) findViewById (R.id.java_camera_view); I changed it to cameraBridgeViewBase = (CameraBridgeViewBase) findViewById (R.id.java_camera_view); This made me try on three versions of opencv .. – Freddy Daniel Mar 27 '21 at 00:32

0 Answers0