ndk-build错误:没有这样的文件或目录

时间:2016-12-05 18:11:54

标签: android c++ opencv android-ndk

我已经使用OpenCV创建了一个项目,我需要使用本机代码进行实时处理,遵循本书中的指南opencv3,这是我的Android.mk文件:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := FinalCamJNI
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_LDLIBS := -lstdc++ # C++ standard library
LOCAL_LDLIBS += -llog # Android logging
LOCAL_LDLIBS += -lz # zlib
LOCAL_STATIC_LIBRARIES := opencv_calib3d
LOCAL_STATIC_LIBRARIES += opencv_features2d
LOCAL_STATIC_LIBRARIES += opencv_flann
LOCAL_STATIC_LIBRARIES += opencv_imgproc
LOCAL_STATIC_LIBRARIES += opencv_core

LOCAL_SRC_FILES := FinalCamJNI.cpp RecolorRCFilter.cpp

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_calib3d
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libopencv_calib3d.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_features2d
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libopencv_features2d.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_flann
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libopencv_flann.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_imgproc
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libopencv_imgproc.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_core
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libopencv_core.a
include $(PREBUILT_STATIC_LIBRARY)

这是我的Application.mk文件:

APP_STL := gnustl_static # GNU STL
APP_CPPFLAGS := -frtti –fexceptions # RTTI, exceptions
APP_ABI := armeabi armeabi-v7a mips x86
APP_PLATFORM := android-8

我在执行ndk-build时遇到此错误:

NDK Error

我检查了目录,并确保我已准备好所有代码文件 在jni文件夹中。

此外,这是我的实施文件:

FinalCamJNI.cpp:

#include <jni.h>
#include "RecolorRCFilter.hpp"

using namespace finalcam;
#ifdef __cplusplus
extern "C" {
#endif
    JNIEXPORT jlong JNICALL
Java_nahuy_hcmus_finalcam_filters_newSelf(
JNIEnv *env, jclass clazz)
{
 RecolorRCFilter *self = new RecolorRCFilter();
 return (jlong)self;
}

JNIEXPORT void JNICALL
Java_nahuy_hcmus_finalcam_filters_deleteSelf(
 JNIEnv *env, jclass clazz, jlong selfAddr)
{
 if (selfAddr != 0)
 {
 RecolorRCFilter *self = (RecolorRCFilter *)selfAddr;
 delete self;
 }
}

JNIEXPORT void JNICALL
Java_nahuy_hcmus_finalcam_filters_apply(
 JNIEnv *env, jclass clazz, jlong selfAddr, jlong srcAddr,jlong dstAddr)
{
 if (selfAddr != 0)
 {
 RecolorRCFilter *self = (RecolorRCFilter *)selfAddr;
 cv::Mat &src = *(cv::Mat *)srcAddr;
 cv::Mat &dst = *(cv::Mat *)dstAddr;
 self->apply(src, dst);
 }
}

#ifdef __cplusplus
} // extern "C"
#endif

RecolorRCFilter.hpp:

#ifndef RECOLOR_RC_FILTER
#define RECOLOR_RC_FILTER

#include <opencv2/core/core.hpp>

namespace finalcam {
class RecolorRCFilter
{
public: // All subsequent methods or variables are public.
 void apply(cv::Mat &src, cv::Mat &dst);
private: // All subsequent methods or variables are private.
 cv::Mat mChannels[4];
};
} // namespace secondsight
#endif // RECOLOR_RC_FILTER

RecolorRCFilter.cpp:

#include "RecolorRCFilter.hpp"

using namespace finalcam;

void RecolorRCFilter::apply(cv::Mat &src, cv::Mat &dst)
{
 cv::split(src, mChannels);
 cv::Mat g = mChannels[1];
 cv::Mat b = mChannels[2];
 // dst.g = 0.5 * src.g + 0.5 * src.b
 cv::addWeighted(g, 0.5, b, 0.5, 0.0, g);
 // dst.b = dst.g
 g.copyTo(b);
 cv::merge(mChannels, 4, dst);
}

任何人都可以解释为什么会发生这种情况以及我可以采取哪些措施来解决这个问题?

0 个答案:

没有答案