Ask Your Question

OpenCV Contrib Android - Module appears in Java, but not in C ++

asked 2018-11-04 19:08:30 -0500

caiocanalli gravatar image

Hello guys,

I have an Android project, and I'm using an OpenCV compilation with the extra modules, from opencv_contrib.

The compilation I am using is available here:

When trying to import the xfeatures2d module into a C ++ file, Android Studio can not find it. However, I can usually import it into a Java class.

Can this be a problem in the CMakeLists file? This is the configuration of my file:

cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_VERBOSE_MAKEFILE on) set(ocvlibs "${CMAKE_SOURCE_DIR}/src/main/jniLibs") include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include)

add_library(libopencv_java3 SHARED IMPORTED) set_target_properties(libopencv_java3 PROPERTIES IMPORTED_LOCATION "${ocvlibs}/${ANDROID_ABI}/")

add_library( native-lib SHARED src/main/cpp/native-lib.cpp )

find_library( log-lib log )

target_link_libraries( native-lib android log libopencv_java3 ${log-lib} )

If not a problem with CMakeLists, any suggestion of where I can change?

Thank you!

edit retag flag offensive close merge delete


using an unsupported 3rd party build is somewhat unfortunate here, 3.3.1 is also ~1 year behind

berak gravatar imageberak ( 2018-11-06 01:46:58 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-09 06:46:26 -0500

caiocanalli gravatar image

I found the problem. I needed to copy the SDK include folder into the project. After copying the folder, the modules began to appear.

Thank you.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-11-04 19:08:30 -0500

Seen: 520 times

Last updated: Nov 09 '18