Ask Your Question
0

Building OpenCV4Android With OpenGL and OpenCL Support

asked 2017-03-29 12:51:45 -0600

g3org3 gravatar image

updated 2017-03-29 12:56:45 -0600

TL;DR:

What is the "official" way to build OpenCV4Android, from source, with OpenGL and OpenCL support?

I am using the Android NDK, and was using the pre-compiled OpenCV4Android binaries. Everything was going well, until I needed to do some texture handling, and had to use the cv::ogl::Buffer class. In this case, my code succeeded to build, because the cv::ogl header was referenced within the core module that is referenced in the CMake file within the pre-built binaries. However, I got the following error:

E/cv::error()(16616): OpenCV Error: No OpenGL support (The library is compiled without OpenGL support) in void {anonymous}::throw_no_ogl(), file /build/master_pack-android/opencv/modules/core/src/opengl.cpp, line 60

So, to get around this, I thought that I should re-build OpenCV4Android, trying to include the OpenGL flag, and (for posterity) explicitly turn on the OpenCL flag-- I have done custom builds on the desktop, no problem.

Building OpenCV4Android with OpenCL is actually pretty straight forward: after following this tutorial, you pass the -DWITH_OPENCL=ON to the .sh script for the target architecture type, and everything works fine.

However, building with OpenGL, seems really difficult. I know that there could be issues with the native OpenGL ES support that Android provides in their NDK, resulting in there being absolutely no-way to support OpenCV implementations of OpenGL. However, I find it weird that the header content for OpenGL would then still be referenced in the source code for Android builds. Also, after looking at the header file for the cv::ogl::Buffer class, it doesn't look like anything should conflict with the OpenGL ES content present in the Android NDK.

What I have tried so far is modifying the OpenGL flags within the parent CMakeLists.txt file in the main OpenCV directory, and the flag within the android.toolchain.cmake file; all with no success.

Any definitive answer on this would really be appreciated! Also, including this information within the development page, would save lots of people trouble! Knowing what they can, and cannot build with is important!

(Also, sorry for not hyperlinking keywords; apparently I have insufficient karma to do so. But, every link I followed was from the openCV website, under the Android Platform list. )

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-04-18 13:55:16 -0600

g3org3 gravatar image

updated 2017-04-18 13:56:27 -0600

As a temporary answer:

I have looked through the source code, and in cv::ocl:: there is specific statement that says OpenGL is only support for desktop platforms.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-03-29 12:51:06 -0600

Seen: 757 times

Last updated: Apr 18 '17