Ask Your Question
1

How can i use onCameraFrame inputframe to image

asked 2018-02-25 09:15:30 -0500

sandwraith8 gravatar image

updated 2018-02-25 09:32:33 -0500

Hello everybody. I'm new in OpenCv4Android and i have a question. I'm using MSER algorithm to draw contour around text. It works perfectly fine when i'm using real time camera frame. But i want to take a picture with camera and then draw contour around the text. So how can i do it with input is a bitmap/picture, not an inputframe taken by onCameraFrame. Here is the code i'm using in my onCameraFrame:

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    CONTOUR_COLOR = new Scalar(255);
    mGrey = inputFrame.gray();
    mRgba = inputFrame.rgba();

    detectText();
    return mRgba;
}

I tried to convert taken image to mat but the detection was very poor compare to real time detection

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
5

answered 2018-12-01 00:20:34 -0500

Akhil Patel gravatar image

updated 2018-12-01 01:39:58 -0500

Using Following code you can take picture input as a bitmap :

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame)
{

    CONTOUR_COLOR = new Scalar(255);
    mGrey = inputFrame.gray();
    mRgba = inputFrame.rgba();
    final Bitmap bitmap = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.ARGB_8888);
   detectText();
   return mRgba;
}
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2018-02-25 09:15:00 -0500

Seen: 121 times

Last updated: Dec 01