0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

opencv4 系のsdkでonCameraViewStartedが呼ばれないエラー回避備忘録

Posted at

概要


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);
        mOpenCvCameraView.setVisibility(CameraBridgeViewBase.VISIBLE);
        mOpenCvCameraView.setCvCameraViewListener(this);
        mOpenCvCameraView.setMaxFrameSize(IMG_Width,IMG_Height);
        mOpenCvCameraView.setClickable(true);

のようにopencvのCameraViewを使おうとしても、

    public void onCameraViewStarted(int width, int height) {
        Log.d(TAG, "onCameraViewStarted w:"+width+"  h:"+height);

    }

で定義されたonCameraViewStarted が呼ばれないというエラーが発生していた。

解決策

opencv3系で動いていたcameraview のコールバックは4系だと書き直す必要があるようだ。
ここのチュートリアルを一回コピーし、そこから徐々に自分のやりたかったことに調整すると良い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?