为了解决这个问题,请点击我的Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
include B:/Android/OpenCV/Libraries/OpenCVModified/install/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl
LOCAL_MODULE := detection_based_tracker
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
include B:/Android/OpenCV/Libraries/OpenCVOriginal/install/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES := DetectionBasedTrackerOriginal_jni.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl
LOCAL_MODULE := detection_based_tracker_original
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := $(TARGET_ARCH_ABI)/libavcodec
LOCAL_SRC_FILES := libprebuilt/libavcodec.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := $(TARGET_ARCH_ABI)/libavformat
LOCAL_SRC_FILES := libprebuilt/libavformat.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := $(TARGET_ARCH_ABI)/libavutil
LOCAL_SRC_FILES := libprebuilt/libavutil.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := $(TARGET_ARCH_ABI)/libswscale
LOCAL_SRC_FILES := libprebuilt/libswscale.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := $(TARGET_ARCH_ABI)/libffmpeg_mediametadataretriever_jni
LOCAL_SRC_FILES := libprebuilt/libffmpeg_mediametadataretriever_jni.so
include $(PREBUILT_SHARED_LIBRARY)
我有一个帮助,我必须稍微修改OpenCV以加快速度。我想证明我在一个同时使用OpenCV的原始版本和修改版本的应用程序中所做的更改的效果。
我已经创建了包装器并在应用程序中成功实现了它们,应用程序为每个包装器调用了正确的底层JNI代码。
问题是,模块似乎只使用一个OpenCV源。它似乎是首先包含的那个,如果我首先编译修改后的DBT,它是修改后的DBT,如果我编译原始的(清理项目之后)它是原来的OpenCV
我有logcat日志确认JNI部分是否正确分开,但两个包装器的OpenCV是统一的。
所以我需要做的是让NDK安装两个版本的OpenCV并使模块使用正确的版本,除了我不知道如何。