Tutorial4 sample renamed to Tutorial-2-MixedProcessing
This commit is contained in:
11
samples/android/tutorial-2-mixedprocessing/jni/Android.mk
Normal file
11
samples/android/tutorial-2-mixedprocessing/jni/Android.mk
Normal file
@@ -0,0 +1,11 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
include ../../sdk/native/jni/OpenCV.mk
|
||||
|
||||
LOCAL_MODULE := mixed_sample
|
||||
LOCAL_SRC_FILES := jni_part.cpp
|
||||
LOCAL_LDLIBS += -llog -ldl
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
@@ -0,0 +1,4 @@
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -fexceptions
|
||||
APP_ABI := armeabi-v7a
|
||||
APP_PLATFORM := android-8
|
27
samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp
Normal file
27
samples/android/tutorial-2-mixedprocessing/jni/jni_part.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <jni.h>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/features2d/features2d.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Sample2NativeProcessing_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Sample2NativeProcessing_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
|
||||
{
|
||||
Mat& mGr = *(Mat*)addrGray;
|
||||
Mat& mRgb = *(Mat*)addrRgba;
|
||||
vector<KeyPoint> v;
|
||||
|
||||
FastFeatureDetector detector(50);
|
||||
detector.detect(mGr, v);
|
||||
for( unsigned int i = 0; i < v.size(); i++ )
|
||||
{
|
||||
const KeyPoint& kp = v[i];
|
||||
circle(mRgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(255,0,0,255));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user