Ask Your Question
2

OpenCV4Android : setResolution(Camera.size) is undefined for cameraBridgeViewBase

asked 2013-03-13 11:56:13 -0600

MysticBE gravatar image

updated 2013-04-17 02:55:28 -0600

Andrey Pavlenko gravatar image

I am currently working with OpenCV Tutorial 2 - Mixed Process, and I wanted to call a list with resolutions. The code is:

public boolean onOptionsItemSelected(MenuItem item) {
  Log.i(TAG, "called onOptionsItemSelected; selected item: " + item);
  if (item == mItemPreviewRGBA) {
    mViewMode = VIEW_MODE_RGBA;
  } else if (item == mItemPreviewGray) {
    mViewMode = VIEW_MODE_GRAY;
  } else if (item == mItemPreviewCanny) {
    mViewMode = VIEW_MODE_CANNY;
  } else if (item == mItemPreviewFeatures) {
    mViewMode = VIEW_MODE_FEATURES;
  } else if (item == mResolutionMenu) {
    int id = item.getItemId();
    Size resolution = mResolutionList.get(id);
    mOpenCvCameraView.setResolution(resolution);
    resolution = mOpenCvCameraView.getResolution();
    String caption = Integer.valueOf(resolution.width).toString() + "x" +
                     Integer.valueOf(resolution.height).toString();
    Toast.makeText(this, caption, Toast.LENGTH_SHORT).show();
  }
  return true;
}

But Eclipse is giving me the next errors (can't launch the app because of this): The Method setResolution(Camera.size) is undefined for the type CameraBridgeViewBase. These occur for the setResolution() and getResolution().

I have no idea what I'm doing wrong and Google isn't of much help.

edit retag flag offensive close merge delete

Comments

nobody who has any idea? still stuck

MysticBE gravatar imageMysticBE ( 2013-03-14 17:54:22 -0600 )edit

3 answers

Sort by » oldest newest most voted
2

answered 2013-04-17 02:25:00 -0600

It looks like you try to use resolution related functionality from Tutorial3-CameraControl example. In this example subclass of JavaCameraView is implemented. The subclass implements the methods you want. You need to use the same approach.

edit flag offensive delete link more
1

answered 2013-04-16 12:42:56 -0600

I guess this says it all :

At this point you should be able to build and run the samples. Keep in mind, that face-detection and Tutorial 2 - Mixed Processing include some native code and require Android NDK and NDK/CDT plugin for Eclipse to build working applications. If you haven’t installed these tools, see the corresponding section of Introduction into Android Development.

Was found in the following guide. So follow the steps mentioned there in order to get the samples to work:

http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html

edit flag offensive delete link more
1

answered 2013-04-16 11:48:10 -0600

Apparently you can get some information here: http://stackoverflow.com/questions/13376420/setting-opencv-video-to-fullscreen-android

It seems to be that it was an error in OpenCV 2.4.3 and the OpenCV hidden those methods. In older versions of 2.4.3, you should use the code:

disconnectCamera();
mMaxHeight = //your desired height
mMaxWidth = //your desired width
connectCamera(mMaxWidth, mMaxHeight);

But I'm still working on it.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-13 11:56:13 -0600

Seen: 5,535 times

Last updated: Apr 17 '13