Android Question OpenCV320 for B4A V1.0 by JordiCP problem

mak55

New Member
Hi to all

I would like to try the opencv library in this thread: https://www.b4x.com/android/forum/posts/636406/
with a trial version of b4a, for evaluation purpose.

It seems that in the version in the first post, 2017/09/27, the class OCVOpenCVLoader has no methods (initDebug and initAsync?) so it's impossible to init the library.
After examination of the lib xml, the methods are not included, and probably not in the jar because adding them in xml give an error too.

Is there a newer version or may be this old version is incompatble with last b4a ?

(Sorry but I post here because I'm not (yet) licensed and I can't pm to the author or post in the original thread.)
 

JordiCP

Well-Known Member
Licensed User
It seems that in the version in the first post, 2017/09/27, the class OCVOpenCVLoader has no methods (initDebug and initAsync?) so it's impossible to init the library.
After examination of the lib xml, the methods are not included, and probably not in the jar because adding them in xml give an error too.
The OpenCVLoader class (in the original lib) allowed the user to choose wether to work with a statically loaded native library or a dinamically linked one by means of the OpenCVManager. This is how the original OpenCV3.20 library worked.
The B4A wrapper lib made use of the static approach because part of the wrapping was made in the native lib.

The only thing needed for a B4A project using OpenCV to run, is to declare, in Main or Starter module's Process_Globals:
B4X:
Dim ocl as OCVOpenCVLoader
This sole declaration will perform a static initialisation where the native .so custom library will be loaded. After this line, the rest of OCV objects can be declared and used (failing to do this, the project will still compile correctly but produce runtime crashes).

This is the reason why the OCVOpenCVLoader still exists but has not methods since lib version 1.0 (perhaps in some beta examples the '.init' methods were still used)
 
Top