opencv4android Hello OpenCV Sample - confused


  1. benjamin.grant.du

    benjamin.grant.du New Member

    Android development with OpenCV — OpenCV 2.4.3 documentation

    Hi All,
    I'm trying the tutorial located here. I have compiled sample code for openCV without issues - so I'm sure I have all the necessary things installed for opencv. I've added the opencv library to my project and I'm compiling with java 1.6 (java 7 doesn't work with opencv4android right now).

    However, the sample code doesn't make sense to me once it gets to step 5 under Hello OpenCV example.
    [HIGH]
    public void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mView = new HelloOpenCVView(this);
    setContentView (mView);
    }[/HIGH]

    Is the code I'm talking about, I immediately get the error "mView cannot be resolved to a variable" which makes sense to me...
    shouldn't it be...

    [HIGH]
    public void onCreate (Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    HelloOpenCVView mView = new HelloOpenCVView(this);
    setContentView (mView);
    }[/HIGH]

    The only thing is mview is consistently used without declaration throughout the code, so I think I'm missing something major. Anyone know what is supposed to be going on here/why it isn't working? Thought that it would be relatively easy to run the hello OpenCV example...

    Advertisement

Share This Page