| 38 | } |
| 39 | |
| 40 | std::vector<cv::Point2f> getNativePointArray(JNIEnv *env, jobjectArray _points) |
| 41 | { |
| 42 | jclass class_PointF = env->FindClass("android/graphics/PointF"); |
| 43 | jfieldID field_x = env->GetFieldID(class_PointF, "x", "F"); |
| 44 | jfieldID field_y = env->GetFieldID(class_PointF, "y", "F"); |
| 45 | assert(class_PointF != nullptr); |
| 46 | assert(field_x != nullptr && field_y != nullptr); |
| 47 | |
| 48 | // Get<Primitive>ArrayRegion, no GetObjectArrayRegion method, fetch element one by one. |
| 49 | jsize feature_point_count = env->GetArrayLength(_points); |
| 50 | std::vector<cv::Point2f> points(feature_point_count); |
| 51 | for(jsize i = 0; i < feature_point_count; ++i) |
| 52 | { |
| 53 | jobject element = env->GetObjectArrayElement(_points, i); |
| 54 | float x = env->GetFloatField(element, field_x); |
| 55 | float y = env->GetFloatField(element, field_y); |
| 56 | points[i] = cv::Point2f(x, y); |
| 57 | env->DeleteLocalRef(element); |
| 58 | } |
| 59 | |
| 60 | return points; |
| 61 | } |
| 62 | |
| 63 | #ifdef ANDROID |
| 64 | uint32_t* lockJavaBitmap(JNIEnv* env, jobject bitmap, AndroidBitmapInfo& info) |
no outgoing calls
no test coverage detected