2011-06-29 15:17:02 +02:00
|
|
|
#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" {
|
2013-04-05 10:17:45 +02:00
|
|
|
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
|
2012-11-19 12:16:13 +01:00
|
|
|
|
2013-02-11 08:36:12 +01:00
|
|
|
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
|
2011-06-29 15:17:02 +02:00
|
|
|
{
|
2012-11-26 09:13:33 +01:00
|
|
|
Mat& mGr = *(Mat*)addrGray;
|
|
|
|
Mat& mRgb = *(Mat*)addrRgba;
|
2011-06-29 15:17:02 +02:00
|
|
|
vector<KeyPoint> v;
|
|
|
|
|
|
|
|
FastFeatureDetector detector(50);
|
2012-11-26 09:13:33 +01:00
|
|
|
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));
|
|
|
|
}
|
2011-06-29 15:17:02 +02:00
|
|
|
}
|
|
|
|
}
|