mirror of
https://github.com/opencv/opencv.git
synced 2024-12-03 16:35:09 +08:00
28 lines
818 B
C++
28 lines
818 B
C++
#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_Tuturial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba);
|
|
|
|
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_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));
|
|
}
|
|
}
|
|
}
|