Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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!