Krapow
Krapow

Reputation: 641

Android Studio app using openCV with openCL

I am very new to Android and I have to code an Android app with openCV.

I try to run the Use OpenCL in Android camera preview based CV application tutorial under Android studio.

I downloaded openCV 3.4 for android and imported the module into my project.

I used adb pull to get libOpenCL.so from my Samsung J5 (which I know supports openCL).

I downloaded OpenCL 1.1 header files and put them in /usr/include/CL

I integrated the java and cpp files from the tutorial samples repo and added the cpp into CMake

In my CMakeList.txt I have:

add_library( # Sets the name of the library.
         native-lib

         # Sets the library as a shared library.
         SHARED

         # Provides a relative path to your source file(s).
         src/main/cpp/native-lib.cpp
         src/main/cpp/jni.c
         src/main/cpp/CLProcessor.cpp)

But I am getting TONS of error like

Error:(749, 23) error: use of undeclared identifier 'malloc'; did you mean 'alloca'?

or

Error:(36, 2) error: Bionic header ctype.h does not define either _U nor _CTYPE_U

Since this is my first ever Android project I am completly lost (I read a lot of papers/answers...).

Can anyone help me?

EDIT: I found why I had these particular compile error: I retrieved openCL 1.1 headers and changing them to 1.2 fixed compile error.

I managed to successfuly compile openCL with openCV (but even though my device has openCL with CL-GL interop, the platform has no openCL extensions at all).

(I have Android Studio 3.0.1 under Debian 9.3.)

Upvotes: 4

Views: 1051

Answers (1)

Krapow
Krapow

Reputation: 641

This compile error is caused by use of openCL 1.1 headers. Use openCl 1.2 instead.

Upvotes: 1

Related Questions