Ask Your Question

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

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

MysticBE gravatar image

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

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) {
  } else if (item == mResolutionMenu) {
    int id = item.getItemId();
    Size resolution = mResolutionList.get(id);
    resolution = mOpenCvCameraView.getResolution();
    String caption = Integer.valueOf(resolution.width).toString() + "x" +
    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


nobody who has any idea? still stuck

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

3 answers

Sort by » oldest newest most voted

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

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

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

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:

edit flag offensive delete link more

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

Apparently you can get some information here:

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:

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


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

Seen: 4,799 times

Last updated: Apr 17 '13