1

I recently moved my Android project from OpenCV 2.4.10 to OpenCV 3.0.

I statically initialize OpenCV using this code:

OpenCVLoader.initDebug();

When I run my app, I get this exception:

java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.imgcodecs.Imgcodecs.imread_1:(Ljava/lang/String;)J

Imgcodecs is a new module in OpenCV 3.0 which replaces Highgui from OpenCV 2.4.* if I am right.

I can see following output in logs from OpenCV when it initializes:

Version control:               2.4.10
...
To be built:                 core androidcamera flann imgproc highgui features2d calib3d ml objdetect video contrib photo java legacy ocl stitching superres ts videostab

From the information above I guess that the OpenCVLoader of OpenCV 3.0 initializes only the old modules from 2.4.10. You can see that it loads highgui module which should not be needed anymore.

Is this a bug of new OpenCV or am I missing something? Is there some workaround how to load also the new modules? Thanks.

Potass
  • 229
  • 3
  • 8

2 Answers2

1

Seems working now using the updated version from 23.6.2015.

The error seems to have been fixed by this commit, so the answer is that the problem was probably caused by an OpenCV bug.

anderas
  • 5,609
  • 29
  • 46
Potass
  • 229
  • 3
  • 8
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Natali Oct 15 '15 at 14:49
  • 1
    I do not agree with you. It is obvious it was a bug on opencv side. So the answer is to use the fixed version. – Potass Oct 15 '15 at 15:06
  • 1
    @Potass If this is correct, your answer would really benefit from a quote from the changelog or a commit message addressing that problem (if it is a known problem). – anderas Oct 16 '15 at 08:01
  • @anderas I am not sure but it could be this [commit](https://github.com/Itseez/opencv/commit/83b2621de4a53506afcd47b69fac210534304fe3). – Potass Oct 17 '15 at 13:23
  • @Potass added that information to the answer, I hope this is what you intended! – anderas Oct 17 '15 at 18:32
0

I suggest that make a new project, add opencv static version, import build.gradle and change the version from 2.4.* to 3.0.* I did the same, my previous version was 2.4.9 and after migration this is 3.0.0

To be Built: hal core flann imgproc ml photo video ***imgcodecs*** shape videoio ..

As this is obvious in your project, you are still on version 2.4.*

Davood Falahati
  • 1,402
  • 16
  • 32