opencv/samples/android/tutorial-3-native/jni/jni_part.cpp

24 lines
633 B
C++
Raw Normal View History

#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" {
2012-10-22 11:25:57 +02:00
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{
2012-10-22 11:25:57 +02:00
Mat* pMatGr=(Mat*)addrGray;
Mat* pMatRgb=(Mat*)addrRgba;
vector<KeyPoint> v;
FastFeatureDetector detector(50);
2012-10-22 11:25:57 +02:00
detector.detect(*pMatGr, v);
for( size_t i = 0; i < v.size(); i++ )
2012-10-22 11:25:57 +02:00
circle(*pMatRgb, Point(v[i].pt.x, v[i].pt.y), 10, Scalar(255,0,0,255));
}
}