Last active
September 23, 2016 22:13
JNI files Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
OPENCV_CAMERA_MODULES:=on | |
OPENCV_INSTALL_MODULES:=on | |
OPENCV_LIB_TYPE:=SHARED | |
include <PATH to opencv for android SDK>/sdk/native/jni/OpenCV.mk | |
LOCAL_MODULE := native-lib | |
LOCAL_SRC_FILES := native-lib.cpp | |
LOCAL_LDLIBS += -llog -ldl | |
include $(BUILD_SHARED_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_STL := gnustl_static | |
APP_CPPFLAGS := -frtti -fexceptions | |
APP_ABI := armeabi-v7a | |
APP_PLATFORM := android-24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <jni.h> | |
#include <sstream> | |
#include <string> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/opencv.hpp> | |
#include <android/log.h> | |
#define LOG_TAG "Native_Lib_JNI" | |
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) | |
int const max_lowThreshold = 100; | |
int ratio = 3; | |
int kernel_size = 3; | |
int lowThreshold = 10; | |
extern "C" { | |
JNIEXPORT jboolean JNICALL | |
Java_navin_tuts_opencv_opencvapp_MainActivity_nativeCanny(JNIEnv *env, jobject instance, long iAddr) { | |
cv::Mat* blur = (cv::Mat*) iAddr; | |
cv::Canny(*blur, *blur, 80, 100, 3); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment