4

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.)

1
  • Do it step by step, First try integrating only OpenCV and when everything is working fine, try OpenCL. Commented Feb 6, 2018 at 4:50

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.