1#include <jni.h> 2#include <opencv2/core/core.hpp> 3#include <opencv2/imgproc/imgproc.hpp> 4#include <opencv2/features2d/features2d.hpp> 5#include <vector> 6 7using namespace std; 8using namespace cv; 9 10extern "C" { 11JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba); 12 13JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba) 14{ 15 Mat& mGr = *(Mat*)addrGray; 16 Mat& mRgb = *(Mat*)addrRgba; 17 vector<KeyPoint> v; 18 19 Ptr<FeatureDetector> detector = FastFeatureDetector::create(50); 20 detector->detect(mGr, v); 21 for( unsigned int i = 0; i < v.size(); i++ ) 22 { 23 const KeyPoint& kp = v[i]; 24 circle(mRgb, Point(kp.pt.x, kp.pt.y), 10, Scalar(255,0,0,255)); 25 } 26} 27} 28