1 | initial version |
Well, I seem to have figured it out.
You need to call initAsync
in onStartCommand
if(OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, getApplicationContext(), mLoaderCallback)) {
Log.i("WDMR", "Loaded OpenCV");
}
else
Log.i("WDMR", "Couldn't load OpenCV");
2 | No.2 Revision |
Well, I seem to have figured it out.
You need to call initAsync
in onStartCommand
if(OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, getApplicationContext(), mLoaderCallback)) {
Log.i("WDMR", Log.i(TAG, "Loaded OpenCV");
}
else
Log.i("WDMR", Log.i(TAG, "Couldn't load OpenCV");
3 | No.3 Revision |
Well, I seem to have figured it out.
You need to call initAsync
in onStartCommand
if(OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, getApplicationContext(), mLoaderCallback)) {
Log.i(TAG, "Loaded OpenCV");
}
else
Log.i(TAG, "Couldn't load OpenCV");
Wait about 1.5 seconds before you use OpenCV libraries for them to be loaded. You could use a delayed runnable.
4 | No.4 Revision |
Well, I seem to have figured it out.
You need to call initAsync
in onStartCommand
if(OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, getApplicationContext(), mLoaderCallback)) {
Log.i(TAG, "Loaded OpenCV");
}
else
Log.i(TAG, "Couldn't load OpenCV");
Wait about 1.5 seconds before you use OpenCV libraries for them to be loaded. You could use a delayed runnable.
Also make sure you override the finish()
function of the BaseLoaderCallback.
5 | No.5 Revision |
Well, I seem to have figured it out.
You need to call initAsync
in onStartCommand
if(OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_4, getApplicationContext(), mLoaderCallback)) {
Log.i(TAG, "Loaded OpenCV");
}
else
Log.i(TAG, "Couldn't load OpenCV");
Wait about 1.5 seconds before you use OpenCV libraries for them to be loaded. You could use a delayed runnable.
Also make sure you override the finish()
function of the BaseLoaderCallback.
BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(
WDMRService.this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS: {
Log.i("", "OpenCV loaded successfully");
}
break;
default: {
super.onManagerConnected(status);
}
break;
}
}
@Override
public void finish() {
// implementing own finish method since openCV treats context as
// activity
}
};
If you're not going to use OpenCV once the service is destroyed, you should unbind the OpenCV service in finish()
. It will work even if you don't, but it is better if you do. I don't because I require OpenCV after the service is destroyed too.