Ask Your Question
1

Callback buffer was too small

asked 2014-07-20 20:54:13 -0600

adilh gravatar image

Hi. I've been trying to get a very basic OpenCV based app to work (at this moment in time, it only takes in an input from the camera). However, I keep coming across this error:

E/Camera-JNI﹕ Callback buffer was too small! Expected 1382400 bytes, but got 608256 bytes!

My main gripe with this seemingly arcane error is that the OpenCV samples work on my phone (Galaxy S3, running CM10.2 (Android 4.3.1). My code is pretty much a carbon copy of the code found in the samples.

public class MainActivity extends ActionBarActivity implements CameraBridgeViewBase.CvCameraViewListener2, View.OnTouchListener {

private CameraView mCameraView;
private static final String TAG = "com.adilhz.logging";

private BaseLoaderCallback mBaseLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        switch(status) {
            case LoaderCallbackInterface.SUCCESS:

                Log.d(TAG,"Loaded OpenCV");

                mCameraView.enableView();
                mCameraView.setOnTouchListener(MainActivity.this);
                break;

            default:
                Log.d(TAG,"OpenCV"+status);
                super.onManagerConnected(status);
                break;

        }
    }
};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_main);
    mCameraView = (CameraView)findViewById(R.id.java_surface_view);
    mCameraView.setVisibility(SurfaceView.VISIBLE);
    mCameraView.setCvCameraViewListener(this);

}

@Override
public void onResume() {
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_9, this, mBaseLoaderCallback);
}

Could someone provide some pointers as to where I'm going wrong?

Thanks, Adil

edit retag flag offensive close merge delete

Comments

Did you ever find our what caused that error? I'm getting the same error too.

E/Camera-JNI(18041): Callback buffer was too small! Expected 608256 bytes, but got 38016 bytes!

cagiva gravatar imagecagiva ( 2015-05-09 11:47:41 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-09-20 05:36:02 -0600

Hi @adilh & @cagiva have you managed to somehow fix this issue? I have the same device with android 6.0.1 and I'm trying to use ocv2.4.11. I was able to increase buffer size by editing/inheriting from JavaCameraView, but the input wa zoomed and glitchy. OpenCV samples run without any problem. My logcat output is similar to yours.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-07-20 20:54:13 -0600

Seen: 2,134 times

Last updated: Jul 20 '14