Ask Your Question

trancewu0317's profile - activity

2013-05-05 10:46:50 -0600 received badge  Editor (source)
2013-05-05 10:46:11 -0600 asked a question OpenCV code integration

I have navigated through the openCV examples and I have some questions about the implementation:

  1. How can I implement the OpenCV setup procedure (private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this)) in some self-defined class type for initialization of a member for that class. The self-defined class is data-structure that would use the Util.loadResource(Context, String) to read some images from the drawable and create an element in the class. I have thought about an idea to deal with it if I can't implement the setup in the self-defined class: try to add the pictures one-by-one from the fragment that instantiate the class. And then comes the second problem.

  2. Can I use openCV in class which extends Fragments? I think that yes I can though there is no example projects doing so and maybe need some brief explanation on how to do it.

  3. When shall I use private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this)? Do I have to do this for all the activity(fragment) or I can do this for once just at the launch activity? I tried the latter one but it is not successful, so I am using private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) in every activity I create.

  4. Also, my code would have some self-written code in c++ which need to be compiled by ndk-build, however I use the async method for openCV library and explicitly use System.loadLibrary("my_lib_name") to load the part I write. Is there any problem with that or I should always use static initialization. My intuition is that since I do not alter the OpenCV code itself so this would be fine but I would like make sure about it.

Thank you very much